OpenStreetMap – How to Set Up an OSM Server with TileCache and Mapnik

mapnikopenstreetmaptilecache

I have been trying for two and a half weeks so far to get a local copy of OpenStreetMap running on a server. I have downloaded the planet file and imported it into a PostGIS database called 'osm'. I have used OSM Mapnik tools to generate an XML stylesheet for Mapnik to use. I have used TileLite to prove that Mapnik can render OSM tiles from the database. The tiles even look the way that I want them to look.

My problem now is that I cannot get TileCache to work with Mapnik. I have a MapServer instance installed that I am using to serve Shapefiles. This works with TileCache. The default 'basic' layer in the TileCache configuration file works as well. Please help with my OSM layer:

[osm]
type=Mapnik
mapfile=/var/maps/bin/mapnik/osm.xml
spherical_mercator=true
bbox=-16697000,8610000,-16667000,8640000
maxResolution=156543.0339/4
levels=18
srs=EPSG:900913

I have read every last blog post, forum post, and tutorial I can find. Any help would be appreciated. I suspect I have either missed something or I am doing something stupid. The problem may even be in OpenLayers.

Best Answer

I needed my TileCache configuration to look like this:

[osm]
type=Mapnik
mapfile=/var/maps/bin/mapnik/osm.xml
spherical_mercator=true

I also needed to use a TMS layer type in OpenLayers. Everything is better now!

Related Question