Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Quotes escaping in strings doesn't work with postgis raster "filename" field #5030
According to http://mapserver.org/mapfile/expressions.html#quotes-escaping-in-strings it should be possible to use a DATA statement like the following:
DATA "PG:host=localhost port=5432 dbname='xxx' user='xxx' password='xxx' schema='raster' table='dem' where='filename='dem20_12.tif'' mode='2' "
but when testing with shp2img each and every quote escaping "tecnique" fails with similar error messages
The escaping within MapServer looks to be working at some level or you'd see a parse error as the mapfile is being read. This looks to be more specific to the PostGIS driver. What specifically does your data statement look like? The syntax in the initial message doesn't look right to me.
referenced this issue
Oct 16, 2017
Example below of how I got around this issue using double dollar signs for the date and geomfromtext query elements:
DATA "PG:host=localhost user='some_user' password='some_password' dbname='some_db' port=5432 schema='public' table='some_table' where='datetime BETWEEN $$2017-05-10T00:00:00.000Z$$::timestamp AND $$2017-06-21T00:00:00.000Z$$::timestamp AND ST_Intersects(rast, ST_Transform(ST_GeomFromText($$POLYGON((-8.463592529296875 51.96203858429277,-8.466339111328127 51.712565159815114,-7.568206787109377 51.72447619956401,-7.573699951171877 51.97219182433531,-8.463592529296875 51.96203858429277))$$, 4326), 32629))' mode='2'"
Leading on from this, maybe another question, but is there a syntax where I can pass a FILTER into the where clause of the DATA element in a mapfile. I know how to do it in the standard setup where DATA defines the geom and table and the FILTER defines the where elements which can be attached to variables passed to the mapfile.
I'm looking for advice on mapfile setup trying to take WMS filters from Openlayers and using them to control the date period and extent of the raster returns. I've got date and extent where element working in the DATA string as per the previous posts example but don't know a syntax to add dynamic query elements being passed into the where element.