[mapserver-users] OGC spatial filter + SLD

Julien Cigar jcigar at ulb.ac.be
Sat Nov 24 05:23:48 PST 2012


On 11/23/2012 19:12, Thomas Gratier wrote:
> Hello,
>

Hello,

> Don't know exactly your case but you can maybe rely on runtime 
> substitution http://mapserver.org/cgi/runsub.html and spatial 
> abilities of your database e.g 
> http://postgis.refractions.net/docs/ST_Within.html
> or on filter (support within 
> http://mapserver.org/mapfile/expressions.html#spatial-expressions-that-return-a-logical-value-geos 
> ) + runtime substitution
> In all case, a bit dirty compare to SLD filter but no choice it seems.
>

I'm slowly progressing on this issue:

- I can confirm that Mapserver supports OGC spatial filters to filter 
WMS requests (so far I've tested with <ogc:BBOX> and <ogc:Within>. The 
filter is converted to an EXPRESSION clause in the Mapfile by Mapserver
for example: EXPRESSION ([shape]  within  fromText('POLYGON 
((24.2073126960992191 0.7680569582964826, 24.2968673039010241 
0.7680569582964826, 24.2968673039010241 0.8576025453261950, 
24.2073126960992191 0.8576025453261950, 24.2073126960992191 
0.7680569582964826))'))

- it seems that there is an obscure bug in the parsing code for the 
<gml:coordinates> tag:

The following works:
<ogc:BBOX>
   <ogc:PropertyName>geom</ogc:PropertyName>
     <gml:Box srsName="http://www.opengis.net/gml/srs/epsg.xml#4326">
       <gml:coordinates decimal="." cs="," ts=" ">24.207313,0.768057 
24.296867,0.857603</gml:coordinates>
     </gml:Box>
</ogc:BBOX>

BUT, if there is a space (or a newline) in the <gml:coordinates 
decimal="." cs="," ts=" "> content it doesn't work, so the followings 
don't work:
<gml:coordinates decimal="." cs="," ts=" "> 24.207313,0.768057 
24.296867,0.857603 </gml:coordinates>

<gml:coordinates decimal="." cs="," ts=" ">
    24.207313,0.768057 24.296867,0.857603
</gml:coordinates>

(...)

HOWEVER, this problem doesn't appear in an <ogc:Within>, in any case the 
<gml:coordinates> is parsed correctly:

So the following works:

<ogc:Within>
   <ogc:PropertyName>geom</ogc:PropertyName>
     <gml:Polygon srsName="http://www.opengis.net/gml/srs/epsg.xml#4326">
       <gml:outerBoundaryIs>
         <gml:LinearRing>
           <gml:coordinates decimal="." cs="," ts=" ">
              24.20731269609922 0.7680569582964826,24.296867303901024
              0.7680569582964826,24.296867303901024 
0.857602545326195,24.20731269609922
              0.857602545326195,24.20731269609922 0.7680569582964826
           </gml:coordinates>
         </gml:LinearRing>
       </gml:outerBoundaryIs>
     </gml:Polygon>
</ogc:Within>

For readability I've pasted the code on http://pastie.org/5427465

Could someone confirm this is a bug .. ?

> Regards
>
> ThomasG

Regards,
Julien




More information about the MapServer-users mailing list