1

I have implemented a simple coordinate transformation test in c# using GDAL 2.4.1 downloaded from https://www.nuget.org/packages/GDAL/. When comparing the result with gdaltransform (QGIS 3.4) and EPSG.io I do encounter a small difference in result.

c# test:

SpatialReference spatialSrc = new SpatialReference(string.Empty);

spatialSrc.ImportFromEPSG(32028);

SpatialReference spatialDest = new SpatialReference(string.Empty);

spatialDest.ImportFromEPSG(4326);

CoordinateTransformation transformator = new CoordinateTransformation(spatialSrc, spatialDest);

double[] result = new double[3];

transformator.TransformPoint(result, 2397350, 386280, 0);

result[0]=-76.3056550480934

result[1]=41.2177849636383

QGIS gdaltransform test:

C:> gdaltransform -s_srs EPSG:32028 -t_srs EPSG:4326

2397350 386280

-76.3053143354412 41.2178680673729 0

Result from EPSG.io (identical to the QGIS result): -76.3053142 41.217868

I seek any explanation of the difference between my c# test and the QGIS/EPSG.io test results.

Am I missing something essential?

  • Your input data is on NAD27 and you're converting to WGS84. The diffrences are almost certainly due to which datum transformations are being used...or not. Set the output to 4267 instead. If you get the same coordinates as one of the above, no transformation is occurring. – mkennedy Jun 20 at 23:11
  • Thanks @mkennedy for your suggestion. You are right apparently no datum transformation is applied as I get identical results when using output to 4267 as you suggest. When generating the WKT for the SpatialReference objects I do see proper datum definitions. Apparently QGIS gdaltransform can handle the transformation chain properly. Does any one know if this is a common problem when using osgeo.osr.coordinatetransformation and how to overcome this? – MortenB Jun 21 at 10:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.