<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:#954F72;
text-decoration:underline;}
p.msonormal0, li.msonormal0, div.msonormal0
{mso-style-name:msonormal;
mso-margin-top-alt:auto;
margin-right:0cm;
mso-margin-bottom-alt:auto;
margin-left:0cm;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
span.E-MailFormatvorlage18
{mso-style-type:personal;
font-family:"Calibri",sans-serif;
color:#1F497D;}
span.E-MailFormatvorlage20
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:#1F497D;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:70.85pt 70.85pt 2.0cm 70.85pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal"><span style="color:#1F497D">Hello,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">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).<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">In principle, this also works.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">If i transform from 31466 to 3857, i have an offset of about 1.5m because gdal transformed via Helmert, not via Beta2007.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">If i transform the same geometrie via proj4 string to use my Beta2007.gsb file, i get a completly wrong geometry.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">sample code to transform via epsg<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Example:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"> var inputGeom = "POINT (2529815.8 5642182.4)";<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"> GdalConfiguration.ConfigureOgr();<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"> var source = new SpatialReference("");<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"> var destination = new SpatialReference("");<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"> source.ImportFromEPSG(31466);<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"> </span><span lang="EN-US" style="color:#1F497D">d</span><span style="color:#1F497D">estination.ImportFromEPSG(3857);<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"> CoordinateTransformation transform = new CoordinateTransformation(source, destination);<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"> Geometry ogrGeom = Geometry.CreateFromWkt(inputGeom);<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"> ogrGeom.Transform(transform);<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"> ogrGeom.ExportToWkt(out string outGeom);<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"> return outGeom;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">value of outGeom: <o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"> POINT (776704.423009968 6626706.00572367)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">if i transform the same geometrie via FME with the CsmapReprojector, i get this (correct) coordinates:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">(776702.2109972419,6626706.521023605)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">FME used the gridfile Beta2007, GDAL not.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">So i tried to transform my geometrie via proj4 string, where I have the possibility to specify the gridfile.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">My gridfile Beta2007.gsb is located here: {ProjectRoot}\bin\Debug\gdal\share\Beta2007.gsb<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Example:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"> var inputGeom = "POINT (2529815.8 5642182.4)";<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"> GdalConfiguration.ConfigureOgr();<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"> var source = new SpatialReference("");<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"> var destination = new SpatialReference("");<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"> source.ImportFromProj4("+proj=tmerc +lat_0=0 +lon_0=6 +k=1 +x_0=2500000 +y_0=0 +ellps=bessel
<a href="mailto:+nadgrids=@BETA2007.gsb">+nadgrids=@BETA2007.gsb</a>");<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"> destination.ImportFromEPSG(3857);<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"> CoordinateTransformation transform = new CoordinateTransformation(source, destination);<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"> Geometry ogrGeom = Geometry.CreateFromWkt(inputGeom);<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"> ogrGeom.Transform(transform);<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"> ogrGeom.ExportToWkt(out string outGeom);<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"> return outGeom;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">value of outGeom:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"> POINT (776787.364952423 6626930.71048604)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">What i need:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Beta2007 Transformation via EPSG code, but i don't know, where i have to change it.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">(optional) if i can't change the transformation via EPSG code via Gridfile, i need to know the correct proj4 string for my transformation.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Best regards,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Carsten</span><span lang="DE" style="font-size:7.5pt;font-family:"Arial",sans-serif;color:#1F497D;mso-fareast-language:#1000"><o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</body>
</html>