Pass dynamic parameters from openlayers to mapsever via tilecache

723 views Asked by At

I'm building a mapping application, where shapes and colours go along this path:

PostGIS > Mapserver > TileChache > OpenLayers

Everything works fine when all parameters are hard coded. But I need users to be able changing paramaters, for example, select features with population greater, than "X", and area under "Y".

I presume, parameters can be passed to Mapserver as a query, attached to mapfile, like this:

.../mapfile.map?area=123&population=456

But I can't find a way to pass that through TileCache. For now - the only workaround I see - is to define a separate layer for any possible combination of X and Y in tilechache.cfg, which does not seem to be a good way. And there must be some limit for number of layers defined in tilechache.cfg

Any solutions?

1

There are 1 answers

4
Stephen Woodbridge On

You probably need to rethink what you are doing here. Tilecache is for static tiles. If you have rendered a tile and put it in tilecache and you change the url argument what do you expect to happen? What if two users request the same tile with different url paramters?

If you have a small number of valid parameters and you want to generate multiple copies of your cache one for every possible unique set of combinations of parameters that the user can select then you can configure tilecache with attributes.

More likely what you want to do is something along the lines of create a tilecache for the static base map and then using additional OpenLayers layers render pull in overlays on demand going directly to mapserver and by passing tilecache.