[gdal-dev] Problem with coordinate transformation
Philippe Lelong
lelong.ph at meltemus.com
Tue Oct 18 03:43:53 PDT 2022
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20221018/c82990f5/attachment.htm>
More information about the gdal-dev
mailing list