[Tilecache] mapnik + tilecache + openlayers

Dane Springmeyer blake at hailmail.net
Mon May 18 22:02:50 EDT 2009


On May 18, 2009, at 1:02 PM, kryptonite wrote:

>
> Hi,
>   I have been trying for the past few days to get a simple map to  
> display
> with mapnik+tilecache+openlayers. I have installed mapnik , and got  
> the
> default rundemo.py running , map.xml being one that was generated.  
> the image
> files were generated too like the documentation on mapnik says.

Great, keep in mind however that those shapefiles that come with the  
'rundemo.py' are in a fairly unique lambert projection. It may be  
easier to try to start with the XML from http://trac.mapnik.org/wiki/XMLGettingStarted 
  that works with a world borders shapefile in EPSG 4326.


> I have also
> successfully displayed a map using openlayers and tilecache but this  
> time
> was with mapserver.
>   But coming to the main problem which is using
> tilecache+openlayers+mapnik. Now all i did in the tilecache.cfg was  
> include
> a layer like this:
>
> [testlayer]
> type=Mapnik
> mapfile=C:\mapnik_0_6_0\demo\python\map.xml
> bbox=-8024477.28459,5445190.38849,-7381388.20071,5662941.44855
> maxResolution=2545.4906698
> extent_type=loose
> srs=EPSG:900913
>

One problem here is that the TileCache Mapnik layer does not respect  
the 'srs' parameter. We need to add this support in the future. In the  
meantime you need to specify the projection with the 'projection'  
parameter and the epsg 900913 proj4 literal as the value:

[test]
type=Mapnik
mapfile=/path/to/mapfile.xml
projection= +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0  
+x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs +over
# bbox for global extent of epsg 900913
bbox=-20037508.34, -20037508.34, 20037508.34, 20037508.34

Also, how are you coming up with the maxRes and bbox?

Dane





More information about the Tilecache mailing list