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

http://ogc.bgs.ac.uk/digmap625k_gsml32_gs/wfs?SERVICE=WFS&VERSION=2.0.0&REQUEST=GetFeature&TYPENAMES=gsml:MappedFeature&BBOX=56.08643859340388,-4.0004826736994445,56.165510496146474,-3.8381055732299343&;

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@6e90bff3 
(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:

http://ogc.bgs.ac.uk/digmap625k_gsml32_gs/wfs?SERVICE=WFS&VERSION=2.0.0&REQUEST=GetFeature&TYPENAMES=gsml:MappedFeature&FILTER=%3Cfes%3AFilter%20xmlns%3Afes%3D%22http%3A%2F%2Fwww.opengis.net%2Ffes%2F2.0%22%20xmlns%3Agml%3D%22http%3A%2F%2Fwww.opengis.net%2Fgml%2F3.2%22%3E%3Cfes%3ABBOX%3E%3Cfes%3AValueReference%3Egsml%3Ashape%3C%2Ffes%3AValueReference%3E%3Cgml%3AEnvelope%20srsName%3D%22EPSG%3A4326%22%3E%3Cgml%3AlowerCorner%3E56.08643859340388%20-4.0004826736994445%3C%2Fgml%3AlowerCorner%3E%3Cgml%3AupperCorner%3E56.165510496146474%20-3.8381055732299343%3C%2Fgml%3AupperCorner%3E%3C%2Fgml%3AEnvelope%3E%3C%2Ffes%3ABBOX%3E%3C%2Ffes%3AFilter%3

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@bb93b18 
(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.
------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60135031&iu=/4140/ostg.clktrk
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to