I have a WFS (using app-schema) which seems to expect coordinates in lat-lon order if I send them in a KVP BBOX query but in lon-lat order if I send them in an XML Filter request. I'm not entirely sure what the expected behaviour according to OGC standards should be but is it really to use the opposite ordering in the two versions or does this behaviour suggest there is some misconfiguration in my service or a bug?
I include an example of each type of request below together with the GeoServer log extracts for each and the spatial part of the generated PostGIS SQL queries sent to the PostGIS data store underlying the service. The GeoServer abstract selection clauses are subtly different ("bbox" vs "gsml:shape bbox") but give rise to opposite ordering of the coordinates in the generated SQL queries.
Any ideas?
Marcus Sen
Query 1 - KVP BBOX
------------------
returns 20 features
In the GeoServer logs this request appears as:
Request: getFeature
service = WFS
version = 2.0.0
baseUrl = http://ogc.bgs.ac.uk:80/digmap625k_gsml32_gs/
outputFormat = text/xml; subtype=gml/3.2
resolve = none
resolveDepth = *
resolveTimeout = 300
resultType = results
abstractQueryExpressionGroup[0] = wfs:abstractQueryExpression=net.opengis.wfs20.impl.QueryTypeImpl@...5927... (handle: null) (abstractProjectionClause: null, abstractSelectionClause: [ bbox POLYGON ((56.08643859340388 -4.0004826736994445, 56.08643859340388 -3.8381055732299343, 56.165510496146474 -3.8381055732299343, 56.165510496146474 -4.0004826736994445, 56.08643859340388 -4.0004826736994445)) ], abstractSortingClause: null, aliases: null, typeNames: [{http://xmlns.geosciml.org/GeoSciML-Core/3.2\}MappedFeature]) (featureVersion: null, srsName: null, filter: null, propertyNames: null, sortBy: null)
abstractQueryExpression[0]:
abstractSelectionClause = [ bbox POLYGON ((56.08643859340388 -4.0004826736994445, 56.08643859340388 -3.8381055732299343, 56.165510496146474 -3.8381055732299343, 56.165510496146474 -4.0004826736994445, 56.08643859340388 -4.0004826736994445)) ]
typeNames[0] = {http://xmlns.geosciml.org/GeoSciML-Core/3.2\}MappedFeature
filter = [ bbox POLYGON ((56.08643859340388 -4.0004826736994445, 56.08643859340388 -3.8381055732299343, 56.165510496146474 -3.8381055732299343, 56.165510496146474 -4.0004826736994445, 56.08643859340388 -4.0004826736994445)) ]
and in the data source PostGIS database it generates a number of queries with the following WHERE clause:
WHERE "the_geom" && ST_GeomFromText('POLYGON ((-4.0004826736994445 56.08643859340388, -4.0004826736994445 56.165510496146474, -3.8381055732299343 56.165510496146474, -3.8381055732299343 56.08643859340388, -4.0004826736994445 56.08643859340388))', 4326) )
Query 2 - XML Filter
If I encode the equivalent (I presume) query in XML format as:
<fes:Filter xmlns:fes="http://www.opengis.net/fes/2.0"
xmlns:gml="http://www.opengis.net/gml/3.2">
<fes:BBOX>
<fes:ValueReference>gsml:shape</fes:ValueReference>
<gml:Envelope srsName="EPSG:4326">
<gml:lowerCorner>56.08643859340388
-4.0004826736994445</gml:lowerCorner>
<gml:upperCorner>56.165510496146474
-3.8381055732299343</gml:upperCorner>
</gml:Envelope>
</fes:BBOX>
</fes:Filter>
and pass this in the FILTER parameter as below:
then I get 0 features returned.
This second query is logged in the GeoServer logs as:
Request: getFeature
service = WFS
version = 2.0.0
baseUrl = http://ogc.bgs.ac.uk:80/digmap625k_gsml32_gs/
outputFormat = text/xml; subtype=gml/3.2
resolve = none
resolveDepth = *
resolveTimeout = 300
resultType = results
abstractQueryExpressionGroup[0] = wfs:abstractQueryExpression=net.opengis.wfs20.impl.QueryTypeImpl@...5928... (handle: null) (abstractProjectionClause: null, abstractSelectionClause: [ gsml:shape bbox POLYGON ((56.08643859340388 -4.0004826736994445, 56.08643859340388 -3.8381055732299343, 56.165510496146474 -3.8381055732299343, 56.165510496146474 -4.0004826736994445, 56.08643859340388 -4.0004826736994445)) ], abstractSortingClause: null, aliases: null, typeNames: [{http://xmlns.geosciml.org/GeoSciML-Core/3.2\}MappedFeature]) (featureVersion: null, srsName: null, filter: null, propertyNames: null, sortBy: null)
abstractQueryExpression[0]:
abstractSelectionClause = [ gsml:shape bbox POLYGON ((56.08643859340388 -4.0004826736994445, 56.08643859340388 -3.8381055732299343, 56.165510496146474 -3.8381055732299343, 56.165510496146474 -4.0004826736994445, 56.08643859340388 -4.0004826736994445)) ]
typeNames[0] = {http://xmlns.geosciml.org/GeoSciML-Core/3.2\}MappedFeature
filter = [ gsml:shape bbox POLYGON ((56.08643859340388 -4.0004826736994445, 56.08643859340388 -3.8381055732299343, 56.165510496146474 -3.8381055732299343, 56.165510496146474 -4.0004826736994445, 56.08643859340388 -4.0004826736994445)) ]
and gives rise to PostGIS queries with a WHERE clause like:
WHERE "the_geom" && ST_GeomFromText('POLYGON ((56.08643859340388 -4.0004826736994445, 56.08643859340388 -3.8381055732299343, 56.165510496146474 -3.8381055732299343, 56.165510496146474 -4.0004826736994445, 56.08643859340388 -4.0004826736994445))', 4326) )
If I swap lat-lon to lon-lat ordering in the second query then I get 20 features back again.
This message (and any attachments) is for the recipient only. NERC is subject to the Freedom of Information Act 2000 and the contents of this email and any reply you make may be disclosed by NERC unless it is exempt from release under the Act. Any material supplied to NERC may be stored in an electronic records management system.