[mapserver-users] How Filter items only if provided parameter

Andrea Peri aperi2007 at gmail.com
Sat Feb 23 04:15:12 PST 2013


Hi,

I need to set a layer to allow to retrieve in the response all the
elements available in the layer, and when the request has a specific
parameter it should apply a filter to limit the show to only the
filtered geometries.

To do this until now I have set this configuration:

LAYER
   ...
    DATA "geometry from table using unique gid srid=25832"
    FILTER "PK_FIELD like '%idvalue%' "
    VALIDATION
      'idvalue' '^[a-zA-Z0-9\-_]+$'
    END
   ...
   METADATA
      'default_idvalue' '%'

This configuration work pretty well when the PK is a string field.
Infact is the request has no the idvalue parameter it show all the
records , thx to the "default_idvalue  %" definitioni,
instead if the request has a parameter as example
..&idvalue=xxx1

It show only the specific item having PK_FIELD=xxx1

Now I have the same need for a layer where the PK is numeric.

With this layer the solution described seem don't work, infact the
'default_idvalue' '%'

is not working with a numeric field.

There same other solution to have the same result?

I need to show all the records and apply the filter only when there is
a specific parameter in the request.

Thx,

-- 
-----------------
Andrea Peri
. . . . . . . . .
qwerty àèìòù
-----------------


More information about the mapserver-users mailing list