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

Paul Lewis paul.lewis at igeotec.com
Wed Feb 7 09:13:23 PST 2018


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



More information about the MapServer-users mailing list