[Cartoweb-users] Creating a filter plugin

Oliver Christen oliver.christen at camptocamp.com
Tue Apr 24 06:54:33 EDT 2007

the easiest way to clear the existing queries is to set via 
filterPostRequest or filterGetRequest a query_clear parameter to trigger the 
query plugin own clear action (which seems to simply clear the session 
object of the plugin btw)

otherwise you need to extend the query plugin to add some kind of accessor 
function to change the values of the queryState object, though i havent 
tried that myself before

mapoverlay only offer some kind of easy tool to change some common values or 
elements. So user dont have to bother with mapscript. Thats why not 
everything was implemented.
But you can do all you need with mapscript, it simply need a bit more code


> Yes, we use persistent query results. I thought about it again and came to 
> the conclusion that synchronizing query results can not work correctly in 
> all cases. Since the boundary of the area queried is not saved, the result 
> can not be extended if the new filter is less restrictive then the 
> original one. Therefore, the best solution would be to remove all 
> persistent query results (of the layer with the filter) if the filter 
> changes. Question: How can the filter plugin remove the persistent 
> results?
> By the way, I was wondering, why I can set the DATA item of a layer object 
> via the MapOverlay plugin, but not the FILTER. Wouldn't that be the better 
> way to filter data? Or is it not possible to set the FILTER item via 
> mapscript?
> Thanks,
> Dirk
>> do you use persistant query result?
>>> Hello Oliver,
>>> thanks. Everything is working now. After a few test, I found out that 
>>> initializeRequest (not handlePreDrawing) needs to be used. Otherwise, 
>>> the query plugin will not recognize the changed map object and return 
>>> all results. Unfortunately, this causes another side effect: If a query 
>>> result exists and the filter is changed, an error is triggered 
>>> ("Attribute query returned no results") if none of the existing query 
>>> results fits the new filter. If at least one result fits the filter, all 
>>> are kept.
>>> Do you have any idea, how I could synchronize the query results if the 
>>> filter changes?
>>> Regards,
>>> Dirk

More information about the Cartoweb-users mailing list