The documented GeoServer axis ordering behaviour for geographic coordinate systems in different WFS versions is documented at http://docs.geoserver.org/latest/en/user/services/wfs/basics.html#axis-ordering. It hasn’t been updated to mention the official SRS URN format in the WFS 2.0.0 standard (urn:ogc:def:crs:EPSG::xxxx) but using these does behave in the same way as the urn:x-ogc:def:crs:EPSG:xxxx format mentioned in the documentation.
In brief I have tested bounding box requests with EPSG:4326 format srs specifications and urn:ogc:def:crs:EPSG::4326 format srs specifications and found the behaviour consistent with the documentation when using a simple WFS created in core GeoServer but with an app-schema complex feature the axis ordering is always long/lat, even with WFS 2.0.0 requests specifying the srs as urn:ogc:def:crs:EPSG::4326.
Some examples can be seen at our service at http://ogc.bgs.ac.uk/digmap625k_gsml32_gs/.
In the following example requests test:UK_625K_BEDROCK_WGS84 is a simple feature created through the core GeoServer GUI and gsml:MappedFeature is a complex feature using app-schema but using the same base table for the geometry property. These requests were POSTed to http://ogc.bgs.ac.uk:80/digmap625k_gsml32_gs/wfs using the Demo requests page. When I say the query is in lat-long or long-lat order below that obviously means that interpreting them in that order makes the BBOX lie within the actual data set.
Request 1 - simple feature query in lat-long order correctly returns 20 features with coordinates in lat-long order:
<?xml version=“1.0” encoding=“UTF-8”?>
<GetFeature
xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance”
xsi:schemaLocation=“http://www.opengis.net/wfs/2.0 http://schemas.opengis.net/wfs/2.0/wfs.xsd
http://www.opengis.net/gml/3.2 http://schemas.opengis.net/gml/3.2.1/gml.xsd”
xmlns=“http://www.opengis.net/wfs/2.0”
xmlns:gsml=“http://xmlns.geosciml.org/GeoSciML-Core/3.2”
xmlns:fes=“http://www.opengis.net/fes/2.0”
xmlns:xlink=“http://www.w3.org/1999/xlink”
xmlns:gml=“http://www.opengis.net/gml/3.2”
version=“2.0.0” service=“WFS” count=“100”>
<Query typeNames=“test:UK_625K_BEDROCK_WGS84” srsName=“urn:ogc:def:crs:EPSG::4326”>
<fes:Filter>
<fes:BBOX>
<fes:ValueReference>the_geom</fes:ValueReference>
<gml:Envelope srsName=“urn:ogc:def:crs:EPSG::4326”>
<gml:lowerCorner>56.08643859340388 -4.0004826736994445</gml:lowerCorner>
<gml:upperCorner>56.165510496146474 -3.8381055732299343</gml:upperCorner>
</gml:Envelope>
</fes:BBOX>
</fes:Filter>
</Query>
</GetFeature>
Request 2 - simple feature query in long-lat order correctly returns 0 features:
<?xml version=“1.0” encoding=“UTF-8”?>
<GetFeature
xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance”
xsi:schemaLocation=“http://www.opengis.net/wfs/2.0 http://schemas.opengis.net/wfs/2.0/wfs.xsd
http://www.opengis.net/gml/3.2 http://schemas.opengis.net/gml/3.2.1/gml.xsd”
xmlns=“http://www.opengis.net/wfs/2.0”
xmlns:gsml=“http://xmlns.geosciml.org/GeoSciML-Core/3.2”
xmlns:fes=“http://www.opengis.net/fes/2.0”
xmlns:xlink=“http://www.w3.org/1999/xlink”
xmlns:gml=“http://www.opengis.net/gml/3.2”
version=“2.0.0” service=“WFS” count=“100”>
<Query typeNames=“test:UK_625K_BEDROCK_WGS84” srsName=“urn:ogc:def:crs:EPSG::4326”>
<fes:Filter>
<fes:BBOX>
<fes:ValueReference>the_geom</fes:ValueReference>
<gml:Envelope srsName=“urn:ogc:def:crs:EPSG::4326”>
<gml:lowerCorner>-4.0004826736994445 56.08643859340388</gml:lowerCorner>
<gml:upperCorner>-3.8381055732299343 56.165510496146474</gml:upperCorner>
</gml:Envelope>
</fes:BBOX>
</fes:Filter>
</Query>
</GetFeature>
Request 3 - complex feature query in lat-long order incorrectly returns 0 features instead of 20:
<?xml version=“1.0” encoding=“UTF-8”?>
<GetFeature
xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance”
xsi:schemaLocation=“http://www.opengis.net/wfs/2.0 http://schemas.opengis.net/wfs/2.0/wfs.xsd
http://www.opengis.net/gml/3.2 http://schemas.opengis.net/gml/3.2.1/gml.xsd”
xmlns=“http://www.opengis.net/wfs/2.0”
xmlns:gsml=“http://xmlns.geosciml.org/GeoSciML-Core/3.2”
xmlns:fes=“http://www.opengis.net/fes/2.0”
xmlns:xlink=“http://www.w3.org/1999/xlink”
xmlns:gml=“http://www.opengis.net/gml/3.2”
version=“2.0.0” service=“WFS” count=“100”>
<Query typeNames=“gsml:MappedFeature” srsName=“urn:ogc:def:crs:EPSG::4326”>
<fes:Filter>
<fes:BBOX>
<fes:ValueReference>gsml:shape</fes:ValueReference>
<gml:Envelope srsName=“urn:ogc:def:crs:EPSG::4326”>
<gml:lowerCorner>56.08643859340388 -4.0004826736994445</gml:lowerCorner>
<gml:upperCorner>56.165510496146474 -3.8381055732299343</gml:upperCorner>
</gml:Envelope>
</fes:BBOX>
</fes:Filter>
</Query>
</GetFeature>
Request 4 - complex feature long-lat order incorrectly returns 20 features instead of 0 (although the coordinates in the returned features are in the correct lat-long order):
<?xml version=“1.0” encoding=“UTF-8”?>
<GetFeature
xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance”
xsi:schemaLocation=“http://www.opengis.net/wfs/2.0 http://schemas.opengis.net/wfs/2.0/wfs.xsd
http://www.opengis.net/gml/3.2 http://schemas.opengis.net/gml/3.2.1/gml.xsd”
xmlns=“http://www.opengis.net/wfs/2.0”
xmlns:gsml=“http://xmlns.geosciml.org/GeoSciML-Core/3.2”
xmlns:fes=“http://www.opengis.net/fes/2.0”
xmlns:xlink=“http://www.w3.org/1999/xlink”
xmlns:gml=“http://www.opengis.net/gml/3.2”
version=“2.0.0” service=“WFS” count=“100”>
<Query typeNames=“gsml:MappedFeature” srsName=“urn:ogc:def:crs:EPSG::4326”>
<fes:Filter>
<fes:BBOX>
<fes:ValueReference>gsml:shape</fes:ValueReference>
<gml:Envelope srsName=“urn:ogc:def:crs:EPSG::4326”>
<gml:lowerCorner>-4.0004826736994445 56.08643859340388</gml:lowerCorner>
<gml:upperCorner>-3.8381055732299343 56.165510496146474</gml:upperCorner>
</gml:Envelope>
</fes:BBOX>
</fes:Filter>
</Query>
</GetFeature>
In the underlying PostGIS database there is an entry in the geometry_columns table for the source table with geometry field:
1558138;“‘’”;“public”;“UK_625K_BEDROCK_WGS84”;“the_geom”;2;4326;“POLYGON”
Running select distinct st_srid(the_geom) from “UK_625K_BEDROCK_WGS84”; in the source PostgreSQL database gives the result 4326.
Searching the issue tracker I can see a number of issues related to axis order in GEOT and GEOS but I can’t tell if any of them are the same as this.
There is some information from logs in the email thread at http://sourceforge.net/mailarchive/forum.php?thread_name=C1D2C279E163C549802E18252065A44102F3A5C1F7%40nerckwmbc.ad.nerc.ac.uk&forum_name=geoserver-users
|