[mapserver-users] SLD named layers and filters fails to draw with SQL error

Ian Turton ijturton at gmail.com
Tue Jan 3 08:00:43 PST 2017


I'm using MapServer 6.4 and I have an SLD file (attached below) that
contains the SLD for two named layers that I want to draw. This will fail
with an SQL error like:

[Tue Jan 03 15:47:02 2017].372000 msPostGISLayerWhichShapes(): Query error.
Error (ERROR:  syntax error at or near ")"
LINE 1: ...8249.045869014 463450.560844313))',27700) and ("id"= 100) ))
                                                                     ^
) executing query: select
"id",encode(ST_AsBinary(ST_Force_2D("wkb_geometry"),'NDR'),'hex') as
geom,"id" from ( SELECT "id", "wkb_geometry", "name", "created_date" FROM
(SELECT * FROM "nsips"."app_sites")  d ) AS qq where wkb_geometry &&
GeomFromText('POLYGON((288249.045869014 463450.560844313,288249.045869014
645745.639155687,569171.454130986 645745.639155687,569171.454130986
463450.560844313,288249.045869014 463450.560844313))',27700) and ("id"=
100) ))
[Tue Jan 03 15:47:02 2017].372000 msDrawMap(): Image handling error. Failed
to draw layer named 'app_sites'.

And it is quite correct that is an invalid SQL - if you delete the last two
) it works fine and returns the required feature.

However if I comment out the filter from either of the layers I get a map
(with too many features drawn).

The only related issue I can see is
https://github.com/mapserver/mapserver/issues/5154 but I'm not sure that it
really applies.

Cheers

Ian

-- 
Ian Turton
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20170103/3bac65ac/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.sld
Type: application/octet-stream
Size: 4077 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20170103/3bac65ac/attachment.obj>


More information about the mapserver-users mailing list