4

I'm confused about the order of the lat/lon pairs when a CSW BBOX request is specified.

On this Geoportal Server CSW page, there is a GetRecords example where clearly the ordering is (lon,lat):

<ogc:BBOX>
  <ogc:PropertyName>ows:BoundingBox</ogc:PropertyName> 
  <gml:Envelope>
    <gml:lowerCorner>-118.3 32.1</gml:lowerCorner> 
    <gml:upperCorner>-87.1 45.2</gml:upperCorner> 
  </gml:Envelope>
</ogc:BBOX>

but on this Data.gov example gist, it says:

"bounding box queries and responses always use axis order latitude longitude"

Is there a way to specify which order the request is using to avoid ambiquity (and possibly incorrect query responses)?

2 Answers 2

3

Based on the discussion above, the answer is that the coordinates are specified in the order determined by the coordinate system you are using. The EPSG codes all specify (lat,lon) order for geographic coordinates, while specifying (x,y) order for projected coordinates.

The OGC, however, in (http://portal.opengeospatial.org/files/?artifact_id=30575) defined a coordinate system transform for (lon,lat) ordering with WGS84 geographic coordinates, so if the CSW server supports it, you can specify:

<ogc:BBOX>
   <ogc:PropertyName>ows:BoundingBox</ogc:PropertyName>
   <gml:Envelope srsName="urn:ogc:def:crs:OGC:1.3:CRS84">
     <gml:lowerCorner> -158.4 20.7</gml:lowerCorner>
     <gml:upperCorner> -157.2 21.6</gml:upperCorner>
   </gml:Envelope>
</ogc:BBOX>

which should result in the same results as

<ogc:BBOX>
  <ogc:PropertyName>ows:BoundingBox</ogc:PropertyName>
  <gml:Envelope srsName="urn:x-ogc:def:crs:EPSG:6.11:4326">
    <gml:lowerCorner> 20.7 -158.4</gml:lowerCorner>
    <gml:upperCorner> 21.6 -157.2</gml:upperCorner>
  </gml:Envelope>
</ogc:BBOX>

This in fact does work in queries to pyCSW, in versions 1.10.1 and higher. See: https://github.com/geopython/pycsw/issues/287

See also this related issue: Is there an EPSG code to specify WGS84 in (lon,lat) order instead of (lat,lon)?

0

The Gist is authoritative iirc. Having said this, the safest way is to be explicit and specify an srsName with the correct axis order, and pycsw (OWSLib) will detect the srsName and process as per the axis ordering rules.

An example can be found at https://github.com/geopython/pycsw/blob/master/tests/suites/default/post/GetRecords-filter-bbox-reproject.xml

9
  • So if I want to ensure (lat,lon) order, I could specify: <gml:Envelope srsName="urn:x-ogc:def:crs:EPSG:6.11:4326"> Is that right? Commented Dec 1, 2014 at 20:26
  • I think that this is authoritative portal.opengeospatial.org/files/?artifact_id=20555. OGC standards are not very easy to interpret. Your both examples are using "QueryConstraintType" of "ogc:Filter" and especially "version" 1.1.0 which means that for finding the correct syntax next step is to go to feature encoding standard v. 1.1.0 portal.opengeospatial.org/files/?artifact_id=51130. That tells that BBOX is "a very common bounding box constraint based on the gml:Envelope geometry". So finally take a right version of GML standard from opengeospatial.org/standards/gml.
    – user30184
    Commented Dec 1, 2014 at 20:39
  • Surely the spec is authorative
    – Ian Turton
    Commented Dec 1, 2014 at 20:47
  • @user30184, do you know which of the many OGC GML standard docs would be the "right version", in this case? Commented Dec 1, 2014 at 20:54
  • @RichSignell CSW uses GML 3.1.1. Commented Dec 1, 2014 at 20:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.