0

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?

Arseni
  • 33
  • 6

1 Answers1

1

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.

Stephen Woodbridge
  • 1,100
  • 1
  • 8
  • 16
  • Thanks for the answer, I got your idea. So I will probably go with separate layer in tilecache.cfg for every combination of params. Hopefully I won't reach a limit of layers if there is one. Speaking of "dynamic vs static" tiles: Ideally, I would want TileCache to treat different combinations of values of parameters as different tiles. So whenever a new combination of params is requested, a new tile would be rendered and cached. Why can TileCache accept parameters like e.g. Lat/Lon as "dynamic" and can't do same with custom parameters. – Arseni Dec 14 '13 at 04:01
  • I don't know the details of Tilecache as I mostly use mapcache that is part of Mapserver, but the concepts are basically the same. The implementation details vary between the various caching packages based in the developer's and the community needs. The whole idea behind a cache is that you can reuse the tiles. If you just create a lot of random tiles because the parameters are always changing, then the reuse is low and it is generally cheaper to just draw on demand. – Stephen Woodbridge Dec 15 '13 at 06:25
  • No, no, sorry, I was not clear in my first message. I Do want to reuse tiles. So new combination of Params will appear in approx. every 1000th request. But I still need to allow any theoretical combination. – Arseni Dec 17 '13 at 10:41
  • Anyways, thanks for your input. I'll check mapcache. It could be, that it has the feature I need. – Arseni Dec 17 '13 at 10:49