To build on this, your data and validation statements would look like:

    DATA "my_geom FROM (select my_id, my_geom from my_table where my_id = 
%my_id%)  as foo USING UNIQUE my_id USING SRID=XXXX"

    VALIDATION
      'my_id' '^[0-9]{1,3}$'
      'default_my_id' '-1'
    END

If the my_id parameter isn't supplied or doesn't validate (e.g. a 3-digit 
number) the default value is used.


--Steve

________________________________
From: mapserver-users <[email protected]> on behalf of 
Lime, Steve D (MNIT) <[email protected]>
Sent: Wednesday, February 7, 2018 7:35:56 PM
To: Paul Lewis; [email protected]
Subject: Re: [mapserver-users] MapFile DATA Syntax for PostGIS raster with 
FILTER

What version? You don’t have to use a filter. You can do it all in the data 
statement plus validation. —Steve
________________________________
From: mapserver-users <[email protected]> on behalf of 
Paul Lewis <[email protected]>
Sent: Wednesday, February 7, 2018 11:13:23 AM
To: [email protected]
Subject: [mapserver-users] MapFile DATA Syntax for PostGIS raster with FILTER

Does anyone have experience of the following issue that they could
possibly offer help or point me in the right direction
I'm trying to pass a dynamic filter to the mapfile but can't work out
the syntax to do so.
The context is having a web-application where I have a WMS layer in
Openlayers that connects to a Mapserver Mapfile which in turn is reading
from a PostGIS raster DB, all latest versions available on a base Ubuntu
16.04 server.
In a vector PostGIS DB case a layer can be configured to have a dynamic
client-side filter through the following base syntax, which is fine and
works for vector tables in the DB:

DATA "geom FROM some_table using unique id using srid=4326"
FILTER (id = '%id%')

As I understand it this in effect this generates an SQL statement where
the FILTER is created as a where clause in the DATA SQL.

However, in a raster DB example the DATA syntax shown at this link
[http://postgis.net/docs/RT_FAQ.html#idm28328] is as follows:

DATA "PG:host=localhost port=5432 dbname='some_db' user='some_user'
password='some_password' schema='some_schema' table='some_table'
where='id=12' mode='2' "

So I can get things to work with hardcoded where elements, i.e. id=12
but in the previous example I could set the id parameter dynamically in
the Openlayers WMS query through the FILTER line.
Does anyone know the syntax to achieve this in the above type of raster
DATA example or is it even possible?

Thanks
_______________________________________________
mapserver-users mailing list
[email protected]
https://lists.osgeo.org/mailman/listinfo/mapserver-users
_______________________________________________
mapserver-users mailing list
[email protected]
https://lists.osgeo.org/mailman/listinfo/mapserver-users

Reply via email to