Tilecache failing to generate tiles using Mapnik

2.2k views Asked by At

I downloaded the Australian OSM extract and moved it into a database called gis using osm2pgsql.

I have changed generate_tiles.py to only generate tiles for Australia:

bbox = (-180.0,-90.0, 180.0,90.0)

render_tiles(bbox, mapfile, tile_dir, 0, 5, "World")

minZoom = 10
maxZoom = 16
bbox = (101.1,-6.9,165.5,-45.9)
render_tiles(bbox, mapfile, tile_dir, minZoom, maxZoom)

When I attempt to generate tiles with: export MAPNIK_MAP_FILE="osm.xml" && export MAPNIK_TILE_DIR="/tmp/tilecache/" && ./z0generate_tiles.py

Lots of directories are created in /tmp/tilecache with png tiles. The tiles have state boundaries and country names and there does appear to be highways. But.. when I navigate to the address: http://localhost/osm/tilecache-2.11/index.html I only see countries and states, but no labels and no streets. I figure it is probably a permissions issue with accessing the postgis data. I have gone into psql and issued: GRANT ALL PRIVILEGES ON DATABASE gis TO PUBLIC

In /etc/tilecache.cfg I have:

[cache]
type=Disk
base=/tmp/tilecache
[osm]
type=Mapnik
mapfile=/home/(my user_name)/bin/mapnik/my_osm.xml
spherical_mercator=true
tms_type=google
metatile=yes
[basic]
type=WMS
url=http://labs.metacarta.com/wms/vmap0
extension=png

It would seem that mapnik is not able to communicate with postgis. I have logged into postgres and executed: GRANT ALL PRIVILEGES ON DATABASE gis TO PUBLIC

I generated the my_osm.xml file with the following:

./generate_xml.py osm.xml my_osm.xml --dbname gis --user (uname) --password (pword) --accept-none

It generated without any errors.

That's about as far as I can take it. New files are being created when accessed via the web, they just don't have any road information. Any ideas?

1

There are 1 answers

1
Dane Springmeyer On BEST ANSWER

One comment:

  • generate_tiles.py and tilecache are different applications and don't know about each other. So, your tilecache config will only be read by the tilecache application. But, if tilecache is used with 'tms_type=google', like you have done, the cache schemes used by each program should match.

Couple things to check on your missing roads:

  • Sometime problems with old geos libraries can lead to lacking data imported by osm2pgsql, so make sure there are a lot of rows in the plant_osm_line table:

    select count(*) from planet_osm_line;

  • Also, make sure you are running the latest Mapnik version, at least 0.7.0, ideally 0.7.1.

  • Try rendering a few maps with nik2img.py and make sure mapnik does now output any warnings that might be causing this - a common issue can be missing proj4 epsg definitions for EPSG:900913