[OpenLayers-Users] WFS getFeature with Filter resulting in Internal Server Error

Bryan Hempen bryanhempen at gmx.de
Sat Jul 9 17:42:01 EDT 2011


Hey!

I am trying to use the example at 
http://openlayers.org/dev/examples/wfs-spatial-filter.html with my own 
WFS (UMN Mapserver) but I am having a hard time getting some problems 
fixed. When I load my test page for the first time OpenLayers sends the 
following request:

<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>the_geom</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>

I get a valid response and the data is properly displayed on the map. 
When, however, I try to use a spatial filter in the request, 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>the_geom</ogc:PropertyName>
<gml:Polygon xmlns:gml="http://www.opengis.net/gml" srsName="EPSG:4326">
<gml:outerBoundaryIs>
<gml:LinearRing>
<gml:coordinates decimal="." cs="," ts=" 
">142.28349609375,-40.5255859375 142.2615234375,-43.49189453125 
148.1501953125,-44.15107421875 149.40263671875,-39.44892578125 
142.28349609375,-40.5255859375</gml:coordinates>
</gml:LinearRing>
</gml:outerBoundaryIs>
</gml:Polygon>
</ogc:Intersects>
<ogc:BBOX>
<ogc:PropertyName>the_geom</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:And>
</ogc:Filter>
</wfs:Query>
</wfs:GetFeature>

... one of the two following things will happen:

1. I get a "Internal Server Error  The server encountered an internal 
error or misconfiguration and was unable to complete your request." The 
logfile says "Premature end of script headers: mapserv.exe, referer: 
http://localhost/".

2. This is the response:

<wfs:FeatureCollection xmlns:wfs="http://www.opengis.net/wfs" 
xmlns:ms="http://mapserver.gis.umn.edu/mapserver" 
xmlns:gml="http://www.opengis.net/gml" 
xmlns:ogc="http://www.opengis.net/ogc" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://www.opengis.net/wfs 
http://schemas.opengis.net/wfs/1.0.0/WFS-basic.xsd 
http://mapserver.gis.umn.edu/mapserver 
http://localhost/cgi-bin/mapserv.exe?map=E:/ms4w/Apache/htdocs/mapservertest/wfs.map&amp;SERVICE=WFS&amp;VERSION=1.0.0&amp;REQUEST=DescribeFeatureType&amp;TYPENAME=ms:omega&amp;OUTPUTFORMAT=XMLSCHEMA"> 

<gml:boundedBy>
<gml:Box srsName="EPSG:4326">
<gml:coordinates>-1.000000,-1.000000 -1.000000,-1.000000</gml:coordinates>
</gml:Box>
</gml:boundedBy>
</wfs:FeatureCollection>

Which one of the two possibilities happens appears to be random. I am 
using the proxy.cgi and when I run http://localhost/cgi-bin/proxy.cgi I 
see the OpenLayers website. Any ideas?

This is how my wfs-spatial-filter.js looks like:

OpenLayers.ProxyHost= "/cgi-bin/proxy.cgi?url=";

.....

var layer = new OpenLayers.Layer.Vector("WFS", {
     strategies: [new OpenLayers.Strategy.BBOX()],
     protocol: new OpenLayers.Protocol.WFS({
         url:  
"http://localhost/cgi-bin/mapserv.exe?map=E:/ms4w/Apache/htdocs/mapservertest/wfs.map",
         featureType: "omega",
         featurePrefix: "ms"
     })
});

....

The rest of the file looks exactly like in the example at 
http://openlayers.org/dev/examples/wfs-spatial-filter.js

Thanks for your help!

Bryan



More information about the Users mailing list