[mapserver-users] MapFile DATA Syntax for PostGIS raster with FILTER

Lime, Steve D (MNIT) steve.lime at state.mn.us
Wed Feb 7 20:14:40 PST 2018


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 <mapserver-users-bounces at lists.osgeo.org> on behalf of Lime, Steve D (MNIT) <steve.lime at state.mn.us>
Sent: Wednesday, February 7, 2018 7:35:56 PM
To: Paul Lewis; mapserver-users at lists.osgeo.org
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 <mapserver-users-bounces at lists.osgeo.org> on behalf of Paul Lewis <paul.lewis at igeotec.com>
Sent: Wednesday, February 7, 2018 11:13:23 AM
To: mapserver-users at lists.osgeo.org
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
mapserver-users at lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapserver-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20180208/03b1f1e1/attachment.html>


More information about the mapserver-users mailing list