Carsten, are you shure that the grid is used during transformation? I know nothing about the C# package, but in my own tests the “not-found” case was often the cause for wrong results. So I tend to almost always use an absolute path to the grid file. Due to historical reasons gdal silently ignores this error.
Ah, and I see that I put an extra +wktext at the end of the arguments. Don’t know if it’s still necessary. Regards Uwe Von: gdal-dev [mailto:[email protected]] Im Auftrag von Carsten Lockenkötter Gesendet: Dienstag, 27. August 2019 14:24 An: [email protected] Betreff: [gdal-dev] GDAL (.NET) coordinate transformation via BETA2007 Hello, because SQLServer can't transform geometries, i have developed a .NET library (C#) that transforms the geometries based on GDAL (NuGet Package GDAL.Native v2.4.2). In principle, this also works. If i transform from 31466 to 3857, i have an offset of about 1.5m because gdal transformed via Helmert, not via Beta2007. If i transform the same geometrie via proj4 string to use my Beta2007.gsb file, i get a completly wrong geometry. sample code to transform via epsg Example: var inputGeom = "POINT (2529815.8 5642182.4)"; GdalConfiguration.ConfigureOgr(); var source = new SpatialReference(""); var destination = new SpatialReference(""); source.ImportFromEPSG(31466); destination.ImportFromEPSG(3857); CoordinateTransformation transform = new CoordinateTransformation(source, destination); Geometry ogrGeom = Geometry.CreateFromWkt(inputGeom); ogrGeom.Transform(transform); ogrGeom.ExportToWkt(out string outGeom); return outGeom; value of outGeom: POINT (776704.423009968 6626706.00572367) if i transform the same geometrie via FME with the CsmapReprojector, i get this (correct) coordinates: (776702.2109972419,6626706.521023605) FME used the gridfile Beta2007, GDAL not. So i tried to transform my geometrie via proj4 string, where I have the possibility to specify the gridfile. My gridfile Beta2007.gsb is located here: {ProjectRoot}\bin\Debug\gdal\share\Beta2007.gsb Example: var inputGeom = "POINT (2529815.8 5642182.4)"; GdalConfiguration.ConfigureOgr(); var source = new SpatialReference(""); var destination = new SpatialReference(""); source.ImportFromProj4("+proj=tmerc +lat_0=0 +lon_0=6 +k=1 +x_0=2500000 +y_0=0 +ellps=bessel [email protected]<mailto:[email protected]>"); destination.ImportFromEPSG(3857); CoordinateTransformation transform = new CoordinateTransformation(source, destination); Geometry ogrGeom = Geometry.CreateFromWkt(inputGeom); ogrGeom.Transform(transform); ogrGeom.ExportToWkt(out string outGeom); return outGeom; value of outGeom: POINT (776787.364952423 6626930.71048604) What i need: Beta2007 Transformation via EPSG code, but i don't know, where i have to change it. (optional) if i can't change the transformation via EPSG code via Gridfile, i need to know the correct proj4 string for my transformation. Best regards, Carsten
_______________________________________________ gdal-dev mailing list [email protected] https://lists.osgeo.org/mailman/listinfo/gdal-dev
