[mapserver-users] WFS Spatial Filter Problem

Bryan Hempen bhempen at sciops.esa.int
Fri Aug 5 07:02:17 EDT 2011


The problem: I am trying to implement something similar to 
http://openlayers.org/dev/examples/wfs-spatial-filter.html with my own 
data served by MapServer through a WFS. I just changed some lines in the 
code to make it work with MapServer, so the code is almost equal to the 
code in the example at the moment. So far it's working fine UNTIL I drag 
the polygon to apply the spatial filter! According to the 
getCapabitilies the server should be able to handle the request:

...
<ogc:Spatial_Capabilities>
<ogc:Spatial_Operators>
<ogc:Equals/>
<ogc:Disjoint/>
<ogc:Touches/>
<ogc:Within/>
<ogc:Overlaps/>
<ogc:Crosses/>
<ogc:Intersect/>
<ogc:Contains/>
<ogc:DWithin/>
<ogc:BBOX/>
</ogc:Spatial_Operators>
</ogc:Spatial_Capabilities>
...

Both WFS GetFeature requests are sent via HTTP POST. The first one that 
works (called on page load) looks like this:

<wfs:GetFeature xmlns:wfs="http://www.opengis.net/wfs" xmlns:xsi="http  
://www.w3.org/2001/XMLSchema-instance" service="WFS" version="1.0.0" 
xsi:schemaLocation="http://www.opengis.net/wfs 
http://schemas.opengis.net/wfs/1.0.0/WFS-transaction.xsd">
<wfs:Query typeName="omega">
<ogc:Filter xmlns:ogc="http://www  .opengis.net/ogc">
<ogc:BBOX>
<ogc:PropertyName>msGeometry</ogc:PropertyName>
<gml:Box xmlns:gml="http:  //www.opengis.net/gml" srsName="EPSG:4326">
<gml:coordinates decimal="." cs="," ts=" ">135.45,-47.425 
157.95,-36.175</gml:coordinates>
</gml:Box>
</ogc:BBOX>
</ogc:Filter>
</wfs:Query>
</wfs:GetFeature>

The request not working looks like this:

<wfs:GetFeature xmlns:wfs="http://www.opengis.net/wfs" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" service="WFS" 
version="1.0.0" xsi:schemaLocation="http://www.opengis.net/wfs 
http://schemas.opengis.net/wfs/1.0.0/WFS-transaction.xsd">
<wfs:Query xmlns:ms="http://mapserver.gis.umn.edu/mapserver" 
typeName="ms:omega">
<ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
<ogc:And>
<ogc:Intersects>
<ogc:PropertyName>msGeometry</ogc:PropertyName>
<gml:Polygon xmlns:gml="http://www.opengis.net/gml" srsName="EPSG:4326">
<gml:outerBoundaryIs>
<gml:LinearRing>
<gml:coordinates decimal="." cs="," ts=" 
">145.72880866081,-40.709423872828 145.83867194206,-42.752880904078 
148.34355475456,-40.995068404078 
145.72880866081,-40.709423872828</gml:coordinates>
</gml:LinearRing>
</gml:outerBoundaryIs>
</gml:Polygon>
</ogc:Intersects>
<ogc:BBOX>
<ogc:PropertyName>msGeometry</ogc:PropertyName>
<gml:Box xmlns:gml="http://www.opengis.net/gml" srsName="EPSG:4326">
<gml:coordinates decimal="." cs="," ts=" ">135.45,-47.40302734375 
157.95,-36.15302734375</gml:coordinates>
</gml:Box>
</ogc:BBOX>
</ogc:And>
</ogc:Filter>
</wfs:Query>
</wfs:GetFeature>

Does anyone have an idea? Any help is appreciated, I am stuck.

The setup:

    * OS: Red Hat Enterprise Linux 5.4
    * PostgreSQL 8.2
    * PostGIS 1.3
    * MapServer 5.6.5
    * OpenLayers, one of the latest versions. ProxyHost set and working
      (calling the proxy.cgi shows OpenLayers website)

Kind regards,
Bryan

================================================================================================
This message and any attachments are intended for the use of the addressee or addressees only. The unauthorised disclosure, 

use, dissemination or copying (either in whole or in part) of its content is not permitted. If you received this message in 

error, please notify the sender and delete it from your system. Emails can be altered and their integrity cannot be guaranteed by   

the sender. 

Please consider the environment before printing this email.
=================================================================================================

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-users/attachments/20110805/95075d16/attachment.html


More information about the mapserver-users mailing list