In a previous post I tried generating OpenStreetMap tiles using GeoServer. It ended when I couldn't find a good style (SLD) to apply the OSM layer.
The (new) idea, that also failed miserably
In this post I tried to use Mapnik to generating OSM map tiles in EPSG:25832. It failed mainly because the Python scripts published by OSM for generating tiles don't support epsg:25832 out of the box. Mapnik is however an obvious choice for OSM because:
- Mapnik can read .osm files
- There is a comprehensive style for Mapnik, that is being maintained by OSM
There is a wiki page for generating map tiles here:
But it does not mention other projections like EPSG:25832. If you have an idea how to accomplish this, feel free to post a comment!
Generating the tiles
Download the map tile tool from OSM subversion. It contains among other things a bunch of python scripts:
svn co http://svn.openstreetmap.org/applications/rendering/mapnik/ cd mapnik less README
To verify your version of Mapnik, do the following in the Python interpreter:
import mapnik mapnik.mapnik_version() # should print 701 or higher
On spatialreference.org there is a special section for initializing Mapnik objects in python according to different projection. The page for epsg:25832 contains the following:
from mapnik import Map, Layer proj4 = '+proj=utm +zone=32 +ellps=GRS80 +units=m +no_defs' m = Map(256,256,proj4) lyr = Layer('Name',proj4)
Danish National Survey and Cadastre have published a http://www.kortforsyningen.dk/articles/tiling44.pdf">tiling scheme for Denmark in ETRS89 UTM zone 32 EPSG:25832. The bounds are as follows (MinX, MinY, MaxX, MaxY):
-299430,4 5241708,8 1378291,2 6919430,4
It is this grid I'd like to create the OpenStreetMap tiles in.
Where things come to a grinding halt
The scripts publised by OpenStreetMap are for generating a different set of tiles with regards to grid and projection. I'm out of ideas on how to use Mapnik to use another grid and projection, mainly because Mapnik is very new to me. If you have an idea, or have accomplished this, I'd like to hear about it!
Some minor issues
I needed to rename some files in the world_boundaries directory, from ne_10m_populated_places.* to 10m_populated_places.*, in order for the generate_image.py script to work.
Also files mentioned in the README file and the actual files in SVN seems to be out of sync...