Rendering Maps: A quick how-to

After a bit of mapping at the Technopark, we planned to render the map offline. This being a step towards the Fort Cochin Heritage Walk Mapping. So, I banged into the #osm channel on irc.oftc.net with the question, the first answer was Mapnik. But Mapnik, essentially, requires you to generate the Postgresql database instance out of the .osm file using osm2pqgsql or osmosis.
But, the quick method is to use Osmarender. The following steps would let you render a good .osm file into a map.

  1. Dowload the xml or .osm data subset of your area of interest.
  2. If you do not have installed subversion system, type sudo apt-get install subversion
  3. Now, you need to get the latest source files of Osmarender, for that type  svn checkout http://svn.openstreetmap.org/applications/rendering/osmarender/
  4. cd to the directory. Probably cd /home/<user_name>/osmarender/
  5. Type  apt-get install xmlstarlet
  6. Now, call the magic!
  7. Type xmlstarlet tr ~/osmarender/xslt/osmarender.xsl  -s osmfile=<file_name>.osm  ~/osmarender/stylesheets/osm-map-features-z17.xml  > <destination_file_name.svg>
  8. You’re done!

Now you should get an svg of the map. I got something like this by tweeking the stylesheets a bit

Map
Map

You can further make additions to the stylesheet files and adjust the parameters to suit your needs. More information is available at the Osmarender wiki.

Leave a Reply

Your email address will not be published. Required fields are marked *