OSM + mapnik + tilecache - was working but now broken?


I am hoping that someone here can shed some light on my problem. As the title suggests, I have a postgis + mapnik + tilecache stack serving map tiles on my test server that we use for application development. I did initial test install on a virtualbox vm and it worked great, so I followed the same installation procedure to install on its own machine and again it worked fine.

Recently I generated some new OSM files (using JOSM), patched the database (using om2pgsql with --append), deleted the contents of the tilecache directory and ran tilecache_seed. The tiles generated are obviously missing lots of data. For example, tertiary/unclassified streets are not being drawn, but the street names are. The top level tiles look fine (national highways are drawn properly) but as I zoom in even sections of the highway disappear (and again occasionally the names are still shown where the road should be).

I have rebuilt the database osm, cleared the cache and rendered multiple times and nothing seems to fix it. To the best of my knowledge nothing specific to tile rendering has been changed. However I have set up a database for pyRouting on the same postgres server - I can not see anything which should conflict, but I think it is worth mentioning.

I fired up the virtualbox vm again and it works fine. Even after patching the OSM files I made it all renders exactly as I hoped.

Any suggestions?



This sounds like something changed in the osm.xml styles (I assume you are using them, or some variation), or the osm2pgsql default.style such that database queries that Mapnik is reading from the stylesheet and sending to Postgres are failing.

I recommend re-installing the latest Mapnik 0.7.0 release, which is better at throwing errors to show you what is wrong. Alternatively, try looking in your postgres logs.

  • Dane

Also, how are you deploying TileCache? Inside apache with mod_python? Make sure to use apache pre-fork, otherwise switch to deploying with mod_wsgi using threads=1 in WSGI Daemon mode.

Thanks for the feedback. I have not changed the osm.xml styles but for good measure I will copy all the relevant files from the vm to the server just in case it somehow was changed or corrupted. I have run tile cache as cgi and with mod_python - both produce the same problem. I am using Ubuntu and did notice that some pre-fork packages were installed when mod_python was installed - I might check out apache anyway.

If replacing the files does not work I will look at 0.7.

Following your advice I checked out the postgres logs, and there each time a request to generate tiles is made I get a lot of messages like

Other messages refer to things other than 'shop’s. I can only assume that I have messed up at some stage with my database, but I am not sure where. I generate my postgis database using:

and then importing my osm data using:

Any suggestions as to what I am missing?

(Thanks again!)

To reply to my own question, I noticed these same errors in the log files on my virtual machine, so I can only guess they are no big deal(?).

I started retracing all my steps, restoring the (mapnik and tilecache) configuration files from the vm to the server, rebuilding new databases, reseeding, etc. The bad tiles just kept showing up in zoom levels ~9 and beyond.

I uninstalled everything, and followed my notes to reinstall and it now works again… for now.

I am still very interesting in hearing form anyone who has seen similar problems before - just in case it happens again.


Update your osm2pgsql, or more specifically, use the most recent default.style to get the shop column.

The default.style goes hand in hand with osm.xml, and you need to keep them in synch.

Hi mark00
Any news on your problem?

I have the same problem you describe: tiles are uncompletely rendered. In some case. This is even the case with a pure raster layer (hillshading only) so I guess this doesn’t have to do with mapnik or postgres.
My setup is similar to the one describe here: