[mapserver-users] passing cgi query params to wms layers

Puneet Kishor punk.kish at gmail.com
Mon Sep 26 19:29:30 PDT 2011


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?


--
Puneet Kishor 


More information about the MapServer-users mailing list