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]
Now test to see if it works:
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:
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 proj446_win32_bin.zip: 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
Now we can get started on tile rendering. You will need subversion for this. Get the latest mapnik rendering tools using the following command:
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.
Now need to generate the osm.xml file which controls tile generation: Type:
generate_xml.py –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:
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(…)