Hi
I’m attempting to submit a GetFeature request to GeoServer (2.1.3) using the POST method. I want to use WFS 1.1.0/gml3 so that I get a “number of features= x” response (WFS 1.0.0 doesn’t return this). I’m using an ‘Intersects’ filter and I’m supplying the vertices of a polygon for the intersect. The POST data is as follows:
var postData =
‘<wfs:GetFeature\n’
-
’ service=“WFS”\n’
-
’ version=“1.1.0”\n’
-
’ outputFormat=“text/xml; subtype=gml/3.1.1”\n’
-
’ maxFeatures=“350”\n’
-
’ xmlns:wfs=“http://www.opengis.net/wfs”\n’
-
’ xmlns:ogc=“http://www.opengis.net/ogc”\n’
-
’ xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance”\n’
-
’ xmlns:gml=“http://www.opengis.net/gml/”\n’
-
’ xsi:schemaLocation="http://www.opengis.net/wfs\n’
-
’ <wfs:Query typeName=“ROS:titleExtents” srs=“urn:x-ogc:def:crs:EPSG:27700”>\n’
-
’ <ogc:Filter xmlns:ogc=“http://www.opengis.net/ogc”>\n’
-
’ ogc:Intersects\n’
-
’ ogc:PropertyNamethe_geom</ogc:PropertyName>\n’
-
’ <gml:Polygon srs=“urn:x-ogc:def:crs:EPSG:27700”>\n’
-
’ gml:exterior\n’
-
’ gml:LinearRing\n’
-
’ gml:posList325114.43014706 673592.1753978 325112.1897978 673577.23973604 325124.8851103 673584.70756692 325114.43014706,673592.1753978</gml:posList>\n’
-
’ </gml:LinearRing>\n’
-
’ </gml:exterior>\n’
-
’ </gml:Polygon>\n’
-
’ </ogc:Intersects>\n’
-
’ </ogc:Filter>\n’
-
’ </wfs:Query>\n’
-
‘</wfs:GetFeature>\n’;
var request = new OpenLayers.Request.POST({
url: ‘/ros/geoserver/wfs’,
data: postData,
headers: {
“Content-Type”: “text/xml”
},
callback: function (response) {
// read the response from GeoServer
var format = new OpenLayers.Format.GML.v3({});
// Add features to vector layer
selection_layer.addFeatures(format.read(response.responseText));
alert(response.responseText);
},
failure: function (response) {
alert(“Invalid request”);
}
});
Unfortunately, I’m getting the following response from Geoserver:
<?xml version="1.0" encoding="UTF-8"?>
<ows:ExceptionReport version="1.0.0"
xsi:schemaLocation="http://www.opengis.net/ows http://31.222.143.15:80/geoserver/schemas/ows/1.0.0/owsExceptionReport.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ows="http://www.opengis.net/ows">
<ows:Exception exceptionCode="NoApplicableCode">
<ows:ExceptionText>java.lang.RuntimeException: Parsing failed for Polygon: java.lang.ClassCastException: java.lang.String cannot be cast to com.vividsolutions.jts.geom.LinearRing
Parsing failed for Polygon: java.lang.ClassCastException: java.lang.String cannot be cast to com.vividsolutions.jts.geom.LinearRing
java.lang.String cannot be cast to com.vividsolutions.jts.geom.LinearRing</ows:ExceptionText>
</ows:Exception>
</ows:ExceptionReport>
The query works fine if I revert to WFS 1.0.0, but for some reason I’m getting this parsing error with WFS 1.1.0. I can’t see what I’m doing wrong here – can anyone help out please?
Thanks
Chris Muir
P Please consider the environment - do you really need to print this email?
This e-mail (and any files or other attachments transmitted with it) is intended solely for the attention of the addressee(s). Unauthorised use, disclosure, storage, copying or distribution of any part of this e-mail is not permitted. If you are not the intended recipient please destroy the email, remove any copies from your system and inform the sender immediately by return.
Registers of Scotland does not accept any liability or responsibility for any damage caused by any virus transmitted by this email or for changes made to this e-mail after it was sent.
All communications to or from Registers of Scotland may be automatically logged, monitored and/or recorded in order to secure the effective operation of the system and for other lawful purposes. The views or opinions contained within this e-mail may not necessarily reflect those of the Keeper of the Registers of Scotland.