Ruprecht-Karls-Universität Heidelberg

Creating Maps of the Neuenheimer Feld

If you want to provide maps of the Neuenheimer Feld — for example for a conference — you have a number of options:

  1. This map taken from here which is stylistically firmly part of the last century, but which one might be able to use for free (I didn’t even ask as recolouring the map seems to be quite tedious).
  2. The official Heidelberg maps with somewhat unclear copyright and terms of use.
  3. Pretty maps by the Print+Medien team which cost 50€/usage (unless you decide to print there, which depending on the order size isn’t cheap either.).
  4. Make your own maps from sources likes OpenStreetMap.

Personally, I find it very regrettable that the university doesn’t provide high-quality maps of its grounds for internal use for free. The “Kommunikation und Marketing” team (which would probably be responsible) only referred me to a subset of the solutions above without providing any substantial help. As all of the options above still require a substantial amount of manual work to point out points of interest, public transportation routes etc., we were rather unwilling to spend time and money on obtaining licenses.

Creating maps from OpenStreetMap is regrettably not totally straight forward either. At relevant zoom levels, the map is riddled with information I consider to be irrelevant for conference attendees.

The easiest way to get something usable seems to be the following:

  1. Get Maperitive. Maperitive has SVG export functions that don’t rely on the excessive use of bitmaps.
  2. In Maperitive, find the Neuenheimer Feld (or whatever) and Download OSM Data.
  3. Save the OSM file save-source file=bloat.osm (it’s just XML) and remove what you consider bloat.
  4. Open the modified OSM source (load-source file=lessbloat.osm) again in Maperitive.
  5. Export to SVG.
  6. Add points of interest, a legend, …
  7. Use that map in whatever form you find useful (and don’t forget to credit OSM!)

Editing the XML file seems necessary, as the SVG export isn’t complete in many ways: Sometimes, when you remove certain text objects, the background is plain white and does not show the map one would expect. The right way to do this would probably be to write a stylesheet only displaying the relevant objects, but this seemed to be even more tedious for this very specific use case.

Removing bloat.

What annoyed me most in the standard SVG export were two things: Large hospital captions that looked horrible when removed in Inkscape later on and one-way directions on roads. Using nokogiri, this is a piece of cake: (Note that if you irb this, it is prudent to surpress output of the assignment of d by appending ;0 to the relevant line.)

 1require 'nokogiri'  
 2d = Nokogiri::XML(File.read('bloat.osm'))
 3d.search('/osm/way[tag[@v="hospital"]]/tag[@k="name"]').remove 
 4d.search('/osm/node[tag[@v="hospital"]]/tag[@k="name"]').remove
 5d.search('/osm/relation[tag[@v="hospital"]]/tag[@k="name"]').remove
 6d.search('tag[@k="oneway"]').remove
 7File.open('lessbloat.osm', 'w') do |f|
 8  f.puts d.to_s
 9end

zuletzt bearbeitet: 2018-05-03 14:57:47 +0200