[Tilecache] multiple layers with openlayers, tilecache

Matt Bartolome mattxbart at gmail.com
Thu Jun 12 20:09:27 EDT 2008


Hi,
I wanted to report a minor bug in TileCache/Layers/Mapnik.py

I came across this by accident when my mapnik xml file was missing one
of the layers I was requesting from tilecache.cfg.

[sticks]
type=Mapnik
mapfile=/var/django/gis/demo/media/mapnik/sticks.xml
layers=sticks,cwagrid
bbox=6251005.5,1801567.375,6363472,2075018.625
srs=espg:2230

If the layer isn't found in your mapnik xml configuration it will try
to print to sys.stderr but will fail because sys is not imported. I
put import sys at the top of the file so it can print the message.

I did have a question though... How does tilecache handle multiple
layers when requested from openlayers?

            layer1 = new OpenLayers.Layer.WMS( "Sticks",
                    "http://tilecache.localhost/tilecache.cgi",
                    {"layers":"sticks,grid", "format":"image/png"})

These parameters yield:

An error occurred: The requested layer (sticks,grid) does not exist.
Available layers are:
 * cwagrid
 * sticks

My tilecache.cfg is:


[sticks]
type=Mapnik
mapfile=/var/django/gis/demo/media/mapnik/sticks.xml
layers=sticks
bbox=6251005.5,1801567.375,6363472,2075018.625
srs=espg:2230

[cwagrid]
type=Mapnik
mapfile=/var/django/gis/demo/media/mapnik/sticks.xml
layers=cwagrid
bbox=6251005.5,1801567.375,6363472,2075018.625
srs=espg:2230

This is my best guess as to how you would do this based on the
openlayer/tilecache docs but it just doesn't like it for some reason.

Thanks,
Matt



More information about the Tilecache mailing list