changing DATA parameter in mapfile via URL

Steve Lime steve.lime at DNR.STATE.MN.US
Thu Apr 21 14:56:35 PDT 2005


For security reasons we don't allow that by default. You have to set the
DATAPATTERN
parameter in the mapfile first. The pattern is nothing more than a
regular expression that
will limit the values that DATA can take. For example:

  DATAPATTERN "xxx|yyy|zzz"

will allow ...&map_layername_data=xxx.shp but not
...&map_layername_data=sss.shp.

Another option is using runtime substitutions. In your layer definition
you'd have something
like:

  LAYER
    DATA %thefile%
    ....
  END

and then you'd set a CGI variable called 'thefile' to hold the name of
a shapefile. If you do the
whole filename as just a single variable you have the hole that
DATAPATTERN was put in place
to plug. You'd probably want to use the %thefile% as part of a longer
file name instead which
would be moderately safe.

Steve

>>> Dylan Beaudette <dylan at IICI.NO-IP.ORG> 4/21/2005 4:48:44 PM >>>
Is is possible to change the 'DATA' parameter via a URL-style variable
such
as:

...&map_layername_data="xxx.shp"

i am able to change every other property of this layer, but not its
data
source.

if this is not possible, does anyone know of some kind of work-around?

i am trying to use a single map file for numerous different shape
files...

thanks in advance!

--
Dylan Beaudette
Soils and Biogeochemistry Graduate Group
University of California at Davis
530.754.7341



More information about the MapServer-users mailing list