More

How do I specify the lon,lat ordering in CSW bounding box request?

How do I specify the lon,lat ordering in CSW bounding box request?


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 aGetRecordsexample where clearly the ordering is (lon,lat):

 ows:BoundingBox  -118.3 32.1 -87.1 45.2

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


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:

 ows:BoundingBox   -158.4 20.7  -157.2 21.6

which should result in the same results as

 ows:BoundingBox   20.7 -158.4  21.6 -157.2

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


The Gist is authoritative iirc. Having said this, the safest way is to be explicit and specify ansrsNamewith the correct axis order, and pycsw (OWSLib) will detect thesrsNameand 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


Watch the video: concept of latitude u0026 longitude