[gdal-dev] Clarifying AxisMappingStrategy for SpatialReference read from GeoJSON in gdal > 3
jratike80
jukka.rahkonen at maanmittauslaitos.fi
Tue Apr 28 23:49:53 PDT 2020
Hi,
The current GeoJSON specification defines CRS in
https://tools.ietf.org/html/rfc7946#section-4
"4. Coordinate Reference System
The coordinate reference system for all GeoJSON coordinates is a
geographic coordinate reference system, using the World Geodetic
System 1984 (WGS 84) [WGS84] datum, with longitude and latitude units
of decimal degrees. This is equivalent to the coordinate reference
system identified by the Open Geospatial Consortium (OGC) URN
urn:ogc:def:crs:OGC::CRS84. An OPTIONAL third-position element SHALL
be the height in meters above or below the WGS 84 reference
ellipsoid. In the absence of elevation values, applications
sensitive to height or depth SHOULD interpret positions as being at
local ground or sea level.
Note: the use of alternative coordinate reference systems was
specified in [GJ2008], but it has been removed from this version of
the specification because the use of different coordinate reference
systems -- especially in the manner specified in [GJ2008] -- has
proven to have interoperability issues."
It has also proven that GIS users keep on using alternative coordinate
reference systems with GeoJSON. The rfc7946 says about this only:
"However, where all involved parties have a prior arrangement, alternative
coordinate reference systems can be used without risk of data being
misinterpreted."
What most involved parties do is to rely on the older GeoJSON specification
https://geojson.org/geojson-spec.html.
"A position is represented by an array of numbers. There must be at least
two elements, and may be more. The order of elements must follow x, y, z
order (easting, northing, altitude for coordinates in a projected coordinate
reference system, or longitude, latitude, altitude for coordinates in a
geographic coordinate reference system). Any number of additional elements
are allowed – interpretation and meaning of additional elements is beyond
the scope of this specification."
So rfc7946 GeoJSON is certainly using OAMS_TRADITIONAL_GIS_ORDER with
lon-lat coordinates or it is invalid, and it is rather safe to guess that if
coordinates are using any other CRS then the a prior arrangement is to use
lon-lat or easting-northing order as in the 2008 specification.
-Jukka Rahkonen-
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).
>
> Cheers,
>
> Sebastien
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at .osgeo
> https://lists.osgeo.org/mailman/listinfo/gdal-dev
--
Sent from: http://osgeo-org.1560.x6.nabble.com/GDAL-Dev-f3742093.html
More information about the gdal-dev
mailing list