Changing map file parameters via URL

Steve Lime Steve.Lime at DNR.STATE.MN.US
Sun Sep 30 23:41:31 EDT 2007


Hi John: Modifying the filter like that is not allowed in 5.0 for security reasons. There 
are workarounds. The easiest is simply to use runtime subs. The filter would like like:

  FILTER "iso_2digit = '%myval%'"

then you'd do a ...&myval=CA&... The only issue would be that you wouldn't have a default
value this way, but could set myval=US to do just that.

You should also consider setting a validation pattern for the myval variable in the web object
metadata. E.g.:

  WEB
    ...
    METADATA
      myval_validation_pattern '^[A-Z]{2}$'
    END
  END

This would further restrict the passed value to a 2 character string.

Steve

>>> John Cartwright <John.C.Cartwright at NOAA.GOV> 09/27/07 7:28 PM >>>
Hello All,

I'm trying to modify an existing layer on a per request basis using
mapserver CGI.  I have a postgis layer defined as:

   LAYER
      NAME US
      ...
      FILTER "iso_2digit = 'US'"
   END

and I am trying to modify the FILTER element by including:

map_US_FILTER=iso_2digit='CA'

in the request.  Can someone point out what I'm doing wrong?  (This is
version 5.0 on MacOSX 10.4)

Thanks!

--john



More information about the mapserver-users mailing list