Skip to content
This repository

Render OpenStreetMap based Topo maps

branch: master
Octocat-spinner-32 custom-symbols Switched all map symbols to use SVG icons. July 27, 2012
Octocat-spinner-32 include Fixed typo August 02, 2012
Octocat-spinner-32 symbols Added missing symbols September 17, 2011
Octocat-spinner-32 templates Removed some old query hacks that mapnik can now do natively July 22, 2012
Octocat-spinner-32 .gitignore Added or improved rendering of many NHD features. July 07, 2012
Octocat-spinner-32 JobManager.py Added current TopOSM files. September 01, 2011
Octocat-spinner-32 NED.py Added NLCD preprocessing. October 29, 2011
Octocat-spinner-32 README.md Changed NED/NHD download link to IP of old OSM-US servers March 24, 2013
Octocat-spinner-32 areas.py Improved rendering of various areas. December 11, 2011
Octocat-spinner-32 colors.txt Improved land cover rendering September 24, 2011
Octocat-spinner-32 common.py Added NLCD preprocessing. October 29, 2011
Octocat-spinner-32 contours.dbf Added current TopOSM files. September 01, 2011
Octocat-spinner-32 contours.shp Added current TopOSM files. September 01, 2011
Octocat-spinner-32 contours.shx Added current TopOSM files. September 01, 2011
Octocat-spinner-32 coords.py Added current TopOSM files. September 01, 2011
Octocat-spinner-32 env.py Cache metatiles on request. July 06, 2012
Octocat-spinner-32 generate_colorrelief_include Added colorrelief test layer for VRT and overviews. September 17, 2011
Octocat-spinner-32 generate_xml Added current TopOSM files. September 01, 2011
Octocat-spinner-32 get_ned Added current TopOSM files. September 01, 2011
Octocat-spinner-32 import_nhd Cleaned up NHD import script. July 07, 2012
Octocat-spinner-32 import_planet Added current TopOSM files. September 01, 2011
Octocat-spinner-32 index.html Fixed extents for contour layer. November 20, 2011
Octocat-spinner-32 logo_small.png Added basic HTML page to view tiles. September 23, 2011
Octocat-spinner-32 mapnik2_erase_patch.diff Added current TopOSM files. September 01, 2011
Octocat-spinner-32 nlcd2006.vrt Tweaked land cover color table. November 22, 2011
Octocat-spinner-32 prep_contours_table Added NLCD preprocessing. October 29, 2011
Octocat-spinner-32 prep_toposm_data Since we're not keeping colormap files around, we don't need a virtua… July 06, 2012
Octocat-spinner-32 set-toposm-env.templ Cache metatiles on request. July 06, 2012
Octocat-spinner-32 toposm.py Prints a different console message depending on whether metatile was … July 13, 2012
Octocat-spinner-32 white50p.png Added basic HTML page to view tiles. September 23, 2011
README.md

TopOSM

A system for rendering OpenStreetMap Based Topographic Maps

Requirements

TopOSM runs on Linux. It may be possible to build and run it on other platforms, but I have not tested this. If you try it, please let me know.

TopOSM depends on some fairly recent software, including:

  • Mapnik (2.0) with included patches and Cairo support
  • Python (2.6)
  • GDAL (1.7)
  • PostgreSQL + PostGIS
  • ImageMagick

(later versions than those mentioned above will probably work)

Installation

Required packages will vary depending on your distribution. For Ubuntu 11.04, this list of packages may be a good start:

python-mapnik mapnik-utils gdal-bin gdal-contrib python-gdal
libgdal-dev proj libproj-dev python-pyproj python-numpy imagemagick
gcc g++ optipng subversion postgresql postgresql-contrib
postgresql-server-dev-8.4 postgis wget libxml2-dev python-libxml2
libgeos-dev libbz2-dev make htop python-cairo python-cairo-dev
osm2pgsql unzip python-pypdf libboost-all-dev libicu-dev libpng-dev
libjpeg-dev libtiff-dev libz-dev libfreetype6-dev libxml2-dev
libproj-dev libcairo-dev libcairomm-1.0-dev python-cairo-dev
libpq-dev libgdal-dev libsqlite3-dev libcurl4-gnutls-dev
libsigc++-dev libsigc++-2.0-dev ttf-sil-gentium
ttf-mscorefonts-installer "ttf-adf-*"

Set up PostgreSQL with PostGIS, see: http://wiki.openstreetmap.org/wiki/Mapnik/PostGIS

Build local patched Mapnik

$ git clone https://github.com/mapnik/mapnik.git
$ cd mapnik
$ patch -p0 < <toposm-dir>/mapnik2_erase_patch.diff
$ python scons/scons.py configure \
    INPUT_PLUGINS=raster,osm,gdal,shape,postgis,ogr \
    PREFIX=$HOME PYTHON_PREFIX=$HOME
$ python scons/scons.py
$ python scons/scons.py install

If you need a more recent boost than available for your system, you can build one locally (i.e. with PREFIX=$HOME) and tell the mapnik configure step to link against that by adding:

BOOST_INCLUDES=$HOME/include BOOST_LIBS=$HOME/lib

Required data files

Configuring the Rendering Environment

Create the required directories for tiles and temp files:

$ mkdir -p temp tile

TopOSM is configured through environment variables. A template for this is included. Make a copy, modify it according to you system, and source it:

$ cp set-toposm-env.templ set-toposm-env
$ emacs set-toposm-env
$ . set-toposm-env

Import OSM data. The import will be cropped to the area specified in set-toposm-env.

$ ./import_planet geodata/osm/Planet.osm

The import script can also import OSM daily diffs (ending in .osc.gz).

Import NHD data:

$ ./import_nhd

Generate hillshade and colormaps:

$ ./prep_toposm_data

Add a shortcut for your area(s) of interest to areas.py.

Generate the mapnik style files from templates:

$ ./generate_xml

(you need to do this every time you modify the styles in the templates and include directories)

Create contour tables and generate contour lines, for example:

$ ./prep_contours_table
$ ./toposm.py prep WhiteMountains

To render tiles for the specified area and zoom levels:

$ ./toposm.py render WhiteMountains 5 15

To render a PDF, use renderToPdf() in toposm.py

Credits

Created by Lars Ahlzen (lars@ahlzen.com), with contributions from Ian Dees (hosting, rendering and troubleshooting), Phil Gold (patches and style improvements), Kevin Kenny (improved NHD rendering, misc patches), Yves Cainaud (legend), Richard Weait (shield graphics) and others.

License: GPLv2

Something went wrong with that request. Please try again.