Hi Philippe, The new behaviour is correct. See https://gdal.org/development/rfc/rfc73_proj6_wkt2_srsbarn.html#axis-order-issues for the axis order issue, a change made in GDAL 3.0. You can find a solution in https://github.com/OSGeo/gdal/blob/v3.5.0/MIGRATION_GUIDE.TXT#L67 (calling SetAxisMappingStrategy(OAMS_TRADITIONAL_GIS_ORDER) on every OGRSpatialReference you use.
Laurentiu On Tue, Oct 18, 2022, at 13:43, Philippe Lelong wrote: > Hi, > > > > I have an app build against GDAL 3.4.1 and PROJ6, and the same app build > against GDAL 2.1.3 and PROJ4. They are not giving the same result when using > OGRCoordinateTransformation. > > > > If I do > > > > > > const char *their = "GEOGCS[\"WGS 84\",DATUM[\"WGS_1984\",SPHEROID[\"WGS > 84\",6378137,298.257223563,AUTHORITY[\"EPSG\",\"7030\"]],AUTHORITY[\"EPSG\",\"6326\"]],PRIMEM[\"Greenwich\",0],UNIT[\"degree\",0.0174532925199433],AUTHORITY[\"EPSG\",\"4326\"]]"; > const char *our = "+proj=longlat +datum=WGS84 +ellps=WGS84 +no_defs > +over"; > double miX = -17.4042; > double miY = 35.3333; > OGRSpatialReference theirReference; > theirReference.importFromWkt((char**)&their); > OGRSpatialReference ourReference; > ourReference.importFromProj4(our); > OGRCoordinateTransformation *trans = > OGRCreateCoordinateTransformation(&theirReference, &ourReference); > trans->Transform(1, &miX, &miY); > > in the version build against GDAL 3.4.1/PROJ6 this code results in swapping > miX and miY (i.e. miX = 35.3333 and miY = -17.4042) > > > The version build against GDAL 2.1.3/PROJ4 leaves miX and miY unchanged, > which I believe is correct. > > > > Any explanation for this behavior and which one is correct? Would I get the > same result using PROJ8 ? > > > > Thanks in advance > > Philippe Lelong > > > > > > _______________________________________________ > gdal-dev mailing list > gdal-dev@lists.osgeo.org > https://lists.osgeo.org/mailman/listinfo/gdal-dev >
_______________________________________________ gdal-dev mailing list gdal-dev@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/gdal-dev