On 9/26/2011 10:29 PM, Puneet Kishor wrote:
I am using OpenLayers as the front-end, requesting a WMS layer from MapServer
that is getting data from Pg. My DATA statement is like so
DATA "the_geom FROM (SELECT gid, pc, the_geom FROM table) t USING UNIQUE gid
USING srid=4326"
FILTER "pc = 'na'"
The above works fine. However, I would like to send the value of "pc" from
OpenLayers (that is another problem that I am experiencing; I have asked on OL list on
how to send query params to WMS layers, but if any of you know the solution, I would
welcome that). In any case, I thought (naively), that I could change my FILTER statement
like so
FILTER "pc = '[pc]'"
I tried sending a WMS query directly to test the above like so
[http://server/cgi-bin/app?.. blah ..&pc=na] but no joy. Forcing a query error
showed me that MapServer was executing the following
select .. from (..) t where the_geom&& GeomFromText(..) and (pc =
'[pc]')
How can I dynamically supply MapServer a filter value?
Does this doc answer your question?
http://mapserver.org/cgi/runsub.html
This should help from the mapserver side of things. In the OpenLayers
side of things you will need to propagate the parameter values into the
base URL for the WMS request and get OpenLayers to propagate that change
into the layer object. If you expect the existing map to change when you
change the values, then you will need to force OpenLayers to redraw the
layer to request a new image or tiles based on the updated parameters.
-Steve W
_______________________________________________
mapserver-users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/mapserver-users