Passing Parameters to Mapserver
I was bitten 4 hours searching for this in the mailing list. I have a postgis layer defined in mapserver map file as follows:
LAYER
NAME "pois"
STATUS DEFAULT
GROUP "pois"
TYPE POINT
CONNECTIONTYPE postgis
PROCESSING "CLOSE_CONNECTION=DEFER"
CONNECTION "user=lbs password=xtlme15n dbname=beijing_stat host=192.168.1.211 port=5432"
#DATA "the_geom from (SELECT poi_id, the_geom FROM poi WHERE new_block_id = 7) as foo USING UNIQUE poi_id USING SRID=4326"
DATA "the_geom from poi as foo USING UNIQUE poi_id USING SRID=4326"
FILTER "new_block_id=%myid%"
CLASS
NAME "block-pois"
STYLE
SYMBOL "circle"
COLOR 255 0 0
SIZE 10
END
END
END
|
Traditionally, I could append and change the FILTER attribute by passing it to the Mapserver CGI as follows:
map.pois.filter=new_block_id%3D700.
Apparently, this changed with Mapserver 5.0. Please see MapServer 4.10 to 5.0 Migration Guide. Thanks to this mailing list thread, it turned out that we need to pass a value to a custom variable set in the mapfile for security reasons. Hope this one, goes in to the docs. I was hoping to comment out in the Mapserver Documentation but registration is holding me off with a ‘Connection Refused’.