[gdal-dev] Clarifying AxisMappingStrategy for SpatialReference read from GeoJSON in gdal > 3
Even Rouault
even.rouault at spatialys.com
Wed Apr 29 02:28:39 PDT 2020
On mardi 28 avril 2020 16:24:32 CEST Yann-Sebastien Tremblay-Johnston wrote:
> Hi,
>
> Tested using conda gdal 3.0.4 and gdal bundled with QGIS (3.0.4)
>
> From the documented changes in gdal > 3 with respect to honouring
> coordinate order i.e. lat/lon order for EPSG:4326, I would expect that when
>
> from osgeo import ogr
>
> > ds = ogr.Open('test.geojson')
> > layer = ds.GetLayer()
> > srs = layer.GetSpatialRef()
> > print(srs.GetAxisMappingStrategy())
>
> to yield
>
> 1 # OAMS_AUTHORITY_COMPLIANT
>
>
> but it yields 0 (OAMS_TRADITIONAL_GIS_ORDER).
> I see that the wording in
> https://gdal.org/tutorials/osr_api_tut.html?highlight=coordinate%20order#crs
> -and-axis-order only
> mentions the OGR Coordinate Transformation class (w.r.t honouring axis
> order), so is the SpatialReference when reading from GeoJSON in how I've
> shown above the intended behavior? I've tried this on both a GeoJSON
> without an explicit crs designation and one with a crs
> of urn:ogc:def:crs:OGC:1.3:CRS84 and both have the same result
> (OAMS_TRADITIONAL_GIS_ORDER).
The behaviour of GDAL < 3 was implictly to honour OAMS_TRADITIONAL_GIS_ORDER when it
returned coordinates, so GDAL 3.0 just takes act of this and all OGR drivers will return a SRS
with OAMS_TRADITIONAL_GIS_ORDER. The only exception might be the GML driver if
opening a dataset when the INVERT_AXIS_ORDER_IF_LAT_LONG=NO open option is set.
For GeoJSON, as the implicit authority is urn:ogc:def:crs:OGC:1.3:CRS84 which has
longitude,latitude order, OAMS_AUTHORITY_COMPLIANT and
OAMS_TRADITIONAL_GIS_ORDER are in practice equivalent.
Welcome to a new world of axis order confusion :-)
Even
--
Spatialys - Geospatial professional services
http://www.spatialys.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20200429/e90b3b8d/attachment.html>
More information about the gdal-dev
mailing list