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