[gdal-dev] WGS84 -> WGS84 transform flips axes

Even Rouault even.rouault at spatialys.com
Thu Feb 6 04:43:28 PST 2020


> In my previous example, if one compares the responses to 
GetAxisMappingStrategy(), the original SRS and that returned by the layer are 
different:
> >>> projection.GetAxisMappingStrategy() == osr.OAMS_AUTHORITY_COMPLIANT
> 
> # True
> 
> >>> projFromLayer.GetAxisMappingStrategy() == osr.OAMS_TRADITIONAL_GIS_ORDER
> 
> # True
> 
> 
> Is the change to this value in this circumstance intentional? 

Yes.

By default OGRSpatialReference object are authority compliant, since that's 
normative. But the reality is that 99% of GDAL code doesn't like that, so most 
drivers will hastily change to OAMS_TRADITIONAL_GIS_ORDER

> If so, does it
> mean that I have to repeatedly enforce the axis mapping strategy, because I
> don't know whether it will have been modified or not, depending on the
> provenance of the SRS object?

If you get vector data + a OGRSpatialReference object from a OGR driver you 
shouldn't override its axis mapping strategy if you intend to reproject from 
it to something else. 99% of the time it will be OAMS_TRADITIONAL_GIS_ORDER, 
but in the rare cases where it would be OAMS_AUTHORITY_COMPLIANT and the SRS 
would be a EPSG geographic CRS, it means that for example the first element in 
the coordinate tuple would be latitude. If you don't override the axis mapping 
strategy, then OGRCoordinateTransformation will do the right thing knowing 
that the first element in the coordinate tuple is a latitude.

Even

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the gdal-dev mailing list