<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)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
{font-family:Wingdings;
panose-1:5 0 0 0 0 0 0 0 0 0;}
@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;}
@font-face
{font-family:Consolas;
panose-1:2 11 6 9 2 2 4 3 2 4;}
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 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.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
{mso-style-priority:34;
margin-top:0cm;
margin-right:0cm;
margin-bottom:0cm;
margin-left:36.0pt;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}
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-MailFormatvorlage19
{mso-style-type:personal;
font-family:"Calibri",sans-serif;
color:#1F497D;}
span.E-MailFormatvorlage20
{mso-style-type:personal;
font-family:"Calibri",sans-serif;
color:#1F497D;}
span.E-MailFormatvorlage21
{mso-style-type:personal;
font-family:"Arial",sans-serif;
color:#993366;}
span.E-MailFormatvorlage22
{mso-style-type:personal;
font-family:"Calibri",sans-serif;
color:#1F497D;}
span.E-MailFormatvorlage24
{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 lang="DE" style="color:#1F497D">Hi,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="DE" style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:#1F497D">a short update to my problem.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:#1F497D">Setting AxisMappingStrategy to OAMS_TRADITIONAL_GIS_ORDER it seems to fix my problem. (GDAL 3.0.1)<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:#1F497D">Transformation from 31466 to 3857 (and reverse) and 4326_3857 (and reverse) returns the same coordinates as FME.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:#1000">src</span><span style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:#1000">.SetAxisMappingStrategy(AxisMappingStrategy.OAMS_TRADITIONAL_GIS_ORDER);<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:#1000">dest</span><span style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:#1000">.SetAxisMappingStrategy(AxisMappingStrategy.OAMS_TRADITIONAL_GIS_ORDER);</span><span lang="EN-US" 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 lang="DE" style="color:#1F497D">Regards,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="DE" 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"><span style="color:#1F497D"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="DE" style="mso-fareast-language:#1000">Von:</span></b><span lang="DE" style="mso-fareast-language:#1000"> gdal-dev <gdal-dev-bounces@lists.osgeo.org>
<b>Im Auftrag von </b>Carsten Lockenkötter<br>
<b>Gesendet:</b> Mittwoch, 4. September 2019 18:46<br>
<b>An:</b> gdal-dev@lists.osgeo.org<br>
<b>Betreff:</b> Re: [gdal-dev] GDAL (.NET) coordinate transformation via BETA2007<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span lang="EN-US" style="color:#1F497D">I have updated my C# application to use the GDAL 3.0.1 binaries from GISInternals.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:#1F497D">Transform via EPSG:
<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:blue;mso-fareast-language:#1000"> var</span><span style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:#1000"> src =
</span><span style="font-size:9.5pt;font-family:Consolas;color:blue;mso-fareast-language:#1000">new</span><span style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:#1000"> SpatialReference(</span><span style="font-size:9.5pt;font-family:Consolas;color:#A31515;mso-fareast-language:#1000">""</span><span style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:#1000">);<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:#1000">
</span><span style="font-size:9.5pt;font-family:Consolas;color:blue;mso-fareast-language:#1000">var</span><span style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:#1000"> dest =
</span><span style="font-size:9.5pt;font-family:Consolas;color:blue;mso-fareast-language:#1000">new</span><span style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:#1000"> SpatialReference(</span><span style="font-size:9.5pt;font-family:Consolas;color:#A31515;mso-fareast-language:#1000">""</span><span style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:#1000">);</span><span lang="EN-US" style="color:#1F497D"><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:blue;mso-fareast-language:#1000"> string</span><span style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:#1000"> wkt =
</span><span style="font-size:9.5pt;font-family:Consolas;color:#A31515;mso-fareast-language:#1000">"POINT(2575957.917 5728085.530)"</span><span style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:#1000">;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:#1000">
</span><span style="font-size:9.5pt;font-family:Consolas;color:blue;mso-fareast-language:#1000">var</span><span style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:#1000"> geom = Geometry.CreateFromWkt(wkt);</span><span style="color:#1F497D"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"> </span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:yellow;mso-highlight:yellow;mso-fareast-language:#1000">src.ImportFromEPSG(31466);</span><span style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:#1000"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:#1000">
<span style="background:yellow;mso-highlight:yellow">dest.ImportFromEPSG(3857);</span><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:blue;mso-fareast-language:#1000"> var</span><span style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:#1000"> transform =
</span><span style="font-size:9.5pt;font-family:Consolas;color:blue;mso-fareast-language:#1000">new</span><span style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:#1000"> CoordinateTransformation(src, dest);<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:#1000"> geom.Transform(transform);<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:#1000"> geom.ExportToWkt(</span><span style="font-size:9.5pt;font-family:Consolas;color:blue;mso-fareast-language:#1000">out</span><span style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:#1000">
</span><span style="font-size:9.5pt;font-family:Consolas;color:blue;mso-fareast-language:#1000">string</span><span style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:#1000"> outWKT);</span><span lang="EN-US" style="color:#1F497D"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:#1F497D">//</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:#1000">
</span><span style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:#1000">"POINT (3993425.20096133 2326133.24005068)"
</span><span lang="DE" style="font-size:9.5pt;font-family:Wingdings;color:black;mso-fareast-language:#1000">à</span><span lang="DE" style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:#1000"> completely wrong<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="DE" style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:#1000"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:#1F497D">With CPL_DEBUG=ON and PROJ_DEBUG=5, I get following information about this transformation:<o:p></o:p></span></p>
<p class="MsoNormal"><img width="825" height="40" style="width:8.5937in;height:.4166in" id="Grafik_x0020_1" src="cid:image001.png@01D567B1.355F5490"><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:#1000"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:#1000"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:#1F497D">Transform via proj4 string:</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:#1000"><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:#1000"> src.ImportFromProj4(</span><span style="font-size:9.5pt;font-family:Consolas;color:maroon;mso-fareast-language:#1000">@"+proj=tmerc
+lat_0=0 +lon_0=6 +k=1 +x_0=2500000 +y_0=0 +ellps=bessel +nadgrids=</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:maroon;mso-fareast-language:#1000">{absolutePath}</span><span style="font-size:9.5pt;font-family:Consolas;color:maroon;mso-fareast-language:#1000">\BETA2007.gsb
+units=m +no_defs +type=crs"</span><span style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:#1000">);<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:#1000"> dest.ImportFromEPSG(3857);<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="DE" style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:#1000">//
</span><span style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:#1000">"POINT (790104.712949148 6742818.48632016)"
</span><span lang="DE" style="font-size:9.5pt;font-family:Wingdings;color:black;mso-fareast-language:#1000">à</span><span lang="DE" style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:#1000"> ok<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:#1000"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:#1F497D">Transform via proj4 +init (deprecated)<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:#1000"> src.ImportFromProj4(</span><span style="font-size:9.5pt;font-family:Consolas;color:#A31515;mso-fareast-language:#1000">"+init=epsg:31466"</span><span style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:#1000">);<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:#1000"> dest.ImportFromEPSG(3857);<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:#1000"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:#1000">//
</span><span style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:#1000">"POINT (790104.712949148 6742818.48632016)"
</span><span lang="DE" style="font-size:9.5pt;font-family:Wingdings;color:black;mso-fareast-language:#1000">à</span><span lang="DE" style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:#1000"> ok<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:#1000"><o:p> </o:p></span></p>
<p class="MsoNormal"><img width="822" height="51" style="width:8.5625in;height:.5312in" id="Grafik_x0020_2" src="cid:image002.png@01D567B1.355F5490"><span style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:#1000"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:#1000"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:#1F497D">Via CMD:<o:p></o:p></span></p>
<p class="MsoNormal"><img width="824" height="76" style="width:8.5833in;height:.7916in" id="Grafik_x0020_3" src="cid:image003.png@01D567B1.355F5490"><span lang="DE" style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:#1000"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="DE" style="font-size:9.5pt;font-family:Wingdings;color:black;mso-fareast-language:#1000">à</span><span lang="DE" style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:#1000"> ok<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:#1000"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:#1F497D">FME returns:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:#1000">(790104.7129438451,6742818.485878875)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:#1000"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:#1F497D">So transforming via EPSG (source and destination) is using a completely wrong transformation in .NET, right?<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:#1F497D">But why?<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:#1F497D">My preferred method to transform is only via EPSG. But what I have to do, that the SpatialReference objects get the right transformation?<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:#1F497D"><o:p> </o:p></span></p>
<div>
<p class="MsoNormal"><span lang="EN-US" style="color:#1F497D">Regards,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:#1F497D">Carsten<o:p></o:p></span></p>
</div>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="DE" style="mso-fareast-language:#1000">Von:</span></b><span lang="DE" style="mso-fareast-language:#1000"> Schmitz, Uwe <<a href="mailto:uwe.schmitz@bezreg-koeln.nrw.de">uwe.schmitz@bezreg-koeln.nrw.de</a>>
<br>
<b>Gesendet:</b> Donnerstag, 29. August 2019 10:30<br>
<b>An:</b> Carsten Lockenkötter <<a href="mailto:carsten.lockenkoetter@gon.de">carsten.lockenkoetter@gon.de</a>>;
<a href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a><br>
<b>Betreff:</b> AW: GDAL (.NET) coordinate transformation via BETA2007<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span lang="DE" style="font-size:12.0pt;font-family:"Arial",sans-serif;color:#993366">Carsten,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="DE" style="font-size:12.0pt;font-family:"Arial",sans-serif;color:#993366"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:12.0pt;font-family:"Arial",sans-serif;color:#993366">are you shure that the grid is used during transformation?<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:12.0pt;font-family:"Arial",sans-serif;color:#993366">I know nothing about the C# package, but in my own tests<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:12.0pt;font-family:"Arial",sans-serif;color:#993366">the “not-found” case was often the cause for wrong results.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:12.0pt;font-family:"Arial",sans-serif;color:#993366">So I tend to almost always use an absolute path to<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:12.0pt;font-family:"Arial",sans-serif;color:#993366">the grid file.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:12.0pt;font-family:"Arial",sans-serif;color:#993366">Due to historical reasons gdal silently ignores this error.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:12.0pt;font-family:"Arial",sans-serif;color:#993366"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:12.0pt;font-family:"Arial",sans-serif;color:#993366">Ah, and I see that I put an extra +wktext at the end of the<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:12.0pt;font-family:"Arial",sans-serif;color:#993366">arguments. Don’t know if it’s still necessary.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:12.0pt;font-family:"Arial",sans-serif;color:#993366"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:12.0pt;font-family:"Arial",sans-serif;color:#993366">Regards<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:12.0pt;font-family:"Arial",sans-serif;color:#993366">Uwe<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:12.0pt;font-family:"Arial",sans-serif;color:#993366"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0cm 0cm 0cm 4.0pt">
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="DE" style="font-size:10.0pt;font-family:"Tahoma",sans-serif;mso-fareast-language:DE">Von:</span></b><span lang="DE" style="font-size:10.0pt;font-family:"Tahoma",sans-serif;mso-fareast-language:DE"> gdal-dev [<a href="mailto:gdal-dev-bounces@lists.osgeo.org">mailto:gdal-dev-bounces@lists.osgeo.org</a>]
<b>Im Auftrag von </b>Carsten Lockenkötter<br>
<b>Gesendet:</b> Dienstag, 27. August 2019 14:24<br>
<b>An:</b> <a href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a><br>
<b>Betreff:</b> [gdal-dev] GDAL (.NET) coordinate transformation via BETA2007<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><span lang="DE"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="DE" style="color:#1F497D">Hello,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="DE" style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="DE" 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 lang="DE" style="color:#1F497D">In principle, this also works.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="DE" style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="DE" 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 lang="DE" 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 lang="DE" style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="DE" style="color:#1F497D">sample code to transform via epsg<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="DE" style="color:#1F497D">Example:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="DE" style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="DE" style="color:#1F497D"> var inputGeom = "POINT (2529815.8 5642182.4)";<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="DE" style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="DE" style="color:#1F497D"> GdalConfiguration.ConfigureOgr();<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="DE" style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="DE" style="color:#1F497D"> var source = new SpatialReference("");<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="DE" style="color:#1F497D"> var destination = new SpatialReference("");<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="DE" style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="DE" style="color:#1F497D"> source.ImportFromEPSG(31466);<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="DE" style="color:#1F497D"> </span>
<span lang="EN-US" style="color:#1F497D">d</span><span lang="DE" style="color:#1F497D">estination.ImportFromEPSG(3857);<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="DE" style="color:#1F497D">
<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="DE" style="color:#1F497D"> CoordinateTransformation transform = new CoordinateTransformation(source, destination);<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="DE" style="color:#1F497D"> Geometry ogrGeom = Geometry.CreateFromWkt(inputGeom);<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="DE" style="color:#1F497D"> ogrGeom.Transform(transform);<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="DE" style="color:#1F497D">
<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="DE" style="color:#1F497D"> ogrGeom.ExportToWkt(out string outGeom);<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="DE" style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="DE" style="color:#1F497D"> return outGeom;<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="DE" style="color:#1F497D">
<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="DE" style="color:#1F497D">value of outGeom: <o:p>
</o:p></span></p>
<p class="MsoNormal"><span lang="DE" style="color:#1F497D"> POINT (776704.423009968 6626706.00572367)<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="DE" style="color:#1F497D"> <o:p></o:p></span></p>
<p class="MsoNormal"><span lang="DE" 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 lang="DE" style="color:#1F497D">(776702.2109972419,6626706.521023605)<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="DE" style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="DE" style="color:#1F497D">FME used the gridfile Beta2007, GDAL not.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="DE" 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 lang="DE" 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 lang="DE" style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="DE" style="color:#1F497D">Example:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="DE" style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="DE" style="color:#1F497D"> var inputGeom = "POINT (2529815.8 5642182.4)";<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="DE" style="color:#1F497D">
<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="DE" style="color:#1F497D"> GdalConfiguration.ConfigureOgr();<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="DE" style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="DE" style="color:#1F497D"> var source = new SpatialReference("");<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="DE" style="color:#1F497D"> var destination = new SpatialReference("");<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="DE" style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="DE" 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 lang="DE" style="color:#1F497D"> destination.ImportFromEPSG(3857);<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="DE" style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="DE" style="color:#1F497D"> CoordinateTransformation transform = new CoordinateTransformation(source, destination);<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="DE" style="color:#1F497D"> Geometry ogrGeom = Geometry.CreateFromWkt(inputGeom);<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="DE" style="color:#1F497D"> ogrGeom.Transform(transform);<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="DE" style="color:#1F497D">
<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="DE" style="color:#1F497D"> ogrGeom.ExportToWkt(out string outGeom);<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="DE" style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="DE" style="color:#1F497D"> return outGeom;<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="DE" style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="DE" style="color:#1F497D">value of outGeom:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="DE" style="color:#1F497D"> POINT (776787.364952423 6626930.71048604)<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="DE" style="color:#1F497D"> <o:p></o:p></span></p>
<p class="MsoNormal"><span lang="DE" style="color:#1F497D"> <o:p></o:p></span></p>
<p class="MsoNormal"><span lang="DE" style="color:#1F497D">What i need:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="DE" 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 lang="DE" 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 lang="DE" style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="DE" style="color:#1F497D">Best regards,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="DE" style="color:#1F497D">Carsten</span><span lang="DE" style="font-size:7.5pt;font-family:"Arial",sans-serif;color:#1F497D"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="DE"><o:p> </o:p></span></p>
</div>
</div>
</body>
</html>