[mapserver-users] FILTER

Steve Lime Steve.Lime at dnr.state.mn.us
Mon Feb 23 13:48:56 EST 2009


You can use runtime substitutions to change values within a FILTER as you go. For example your
FILTER could be written like so:

  FILTER ("multimedia='[multimedia]' and seats >= [nseats] and Sound= '[sound]')

Then (assuming you're using the CGI interface) you could pass in variables named multimedia, nseats
and sound with values defined by the user in an HTML form.

You should also define validation expressions on these variables to guard against unintentional SQL
being submitted to postgis. Within the layer metadata you'd do the following:

  METADATA
    'multimedia_validation_string' '^yes|no$'
    'sound_validation_string' '^yes|no$'
    'nseats_validation_string' '^[0-9]{1,2}$'
    ... more metadata ...
  END

The validation strings are regular expressions that are applied against the appropriate variable value
before being added to the FILTER. The first two limit the value of multimedia and sound to yes or no.
The third limits the value for nseats to a 2 digit integer.

Steve

>>> On 2/19/2009 at 10:34 AM, in message
<b349f0c40902190834r280abc90lf7af51a9bf53de1d at mail.gmail.com>, "A.Pratheepan"
<prathee11 at gmail.com> wrote:
> Hi
> i'm New one to map server. I'm Using PostgreSQL 8.3 with pgAdminIII and post
> GIS. Upto now I've populated my database in post GIS and Map also working
> succesfully. Now my problem is Filter. Filter is working without any problem
> under my layer(lecture_hall layer). Ex FILTER ("multimedia='yes' and seats
>>= 95 and Sound= 'yes')"  It gives the out put in the map which mean shows
> in the out put the condition satisfied lecture halls. Now i want to input
> these filter condition via the user interface. I Used html page. But i'm
> failing. Pls Send me any ideas to solve this problem.
> I've attached my map file & html file
> 
> Please help me..............



More information about the mapserver-users mailing list