[mapserver-users] WFS getFeature Filter resulting in Internal Server Error

Bryan Hempen bryanhempen at gmx.de
Sat Jul 9 17:21:38 EDT 2011


Hey!

I have set up Mapserver to serve data from my PostGIS database through a 
WFS. I am using OpenLayers as a client. 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. Any ideas?

This is my mapfile :

MAP
     NAME "WFS Server"
     STATUS ON
     SIZE 600 400
     SYMBOLSET "E:\ms4w\Apache\htdocs\mapservertest\symbols\symbols.sym"
     EXTENT -180 -90 180 90
     UNITS DD
     SHAPEPATH "E:\ms4w\Apache\htdocs\mapservertest\data\"
     IMAGECOLOR 255 255 255
     FONTSET "E:\ms4w\Apache\htdocs\mapservertest\fonts\fonts.list"
     MAXSIZE 4096


#IMAGECOLOR     200 200 200 #commented out for WFS

PROJECTION
        'init=epsg:4326'
END
     WEB
     TEMPLATE  'E:\ms4w\Apache\htdocs\mapservertest\template.html'
     IMAGEPATH 'E:\ms4w\Apache\htdocs\tmp\'
     IMAGEURL  '/tmp/'
       METADATA
             "wfs_title"                  "WFS Demo Server for 
MapServer" ## REQUIRED
             "wfs_onlineresource"         
"http://localhost/cgi-bin/mapserv.exe?map=E:/ms4w/Apache/htdocs/mapservertest/wfs.map&" 
## Recommended
             "wfs_srs"                    "EPSG:4326" ## Recommended
             "wfs_abstract"               "This text describes my WFS 
service." ## Recommended
       END
     END

LAYER
     NAME   "omega"
     STATUS       DEFAULT
     TYPE         LINE
     METADATA
         "wfs_title"             "omega" ##REQUIRED
         "wfs_srs"               "EPSG:4326" ## REQUIRED
          "gml_include_items"     "all" ## Optional (serves all 
attributes for layer)
         "gml_featureid"         "product_id" ## REQUIRED
     END
     PROJECTION
         "init=epsg:4326"
     END
     CONNECTIONTYPE POSTGIS
     CONNECTION "xxxx"
     DATA "the_geom from alldata using unique product_id using SRID=4326"
     CLASS
         STYLE
             OUTLINECOLOR    125 0 0
         END
     END
     DUMP TRUE             ## REQUIRED
END # layer


END


Thanks for your help.

Cheers,
Bryan






More information about the mapserver-users mailing list