OpenStreetMap (OSM) Install on Windows – Part II – Generate Tiles

Configure The Software

Now you have map data in your data [Part I], its time to generate the map tiles.

First of all, go get 7-Zip and install it as you are going to need it.

Next you will need to install MAPNIK, which is a cross platform toolkit for desktop and server based map rendering.  The Windows version is a bit behind but is still perfectly serviceable for our needs.

Download the software from here. Unpack it and add a path to its \lib directory. [The version was  mapnik-2.0.1rc0 when I downloaded]

set PATH=%PATH%;c:\mapnik-2.0.1rc0\lib

Now test to see if it works:

cd c:\mapnik-2.0.1rc0\demo\c++

rundemo ..\..\lib\mapnik

Once you are happy with this, you need to install the Python bindings from here. Once installed, add to your path and generate a required environment variable.

Add Python to your path [ C:\Python27 ]

Make a new environment variable PYTHONPATH pointing to c:\mapnik-2.0.1rc0\python\2.7\site-packages;

Check python / mapnik are OK with:

cd c:\mapnik-2.0.1rc0\demo\python


Before we can start generating tiles, we need just one more library. Make sure to add theproj.4 Cartographic Projections Library,  It can be found here.  Look for the Prebuilt Win32 executables, DLL including NAD27 grid shift files.

Add the \bin directory to your path and make a new environment variable PROJ_LIB pointing to C:\proj\nad

Tile Rendering

Now we can get started on tile rendering.  You will need subversion for this.  Get the latest mapnik rendering tools using the following command:

svn export

To render tiles from the database, you will also need some other information files for coastlines etc.  Download these and unpack into c:\mapnik\world_boundaries

Now perform a quick check to make sure everything is installed correctly.  Go to the C:\mapnik directory and execute the following command. -h

Now need to generate the osm.xml file which controls tile generation:  Type: –host localhost –user postgres –dbname gis –symbols symbols/ –world_boundaries world_boundaries/ –port 5432 –password ‘password’

You are now in a position to generate tiles. Run the  following to test image generation:

set MAPNIK_MAP_FILE=osm.xml

set MAPNIK_TILE_DIR=C:\tiles

set HOME=C:\Users

If ok, generate tiles from the loaded database [can take a very very long time … we are talking days] using the following command.  Note that you will probably want to edit the bounding box entries [e.g. bbox = (…)] to control which areas you render tiles for and to what zoom level. render_tiles(…)