<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
Hi,
<blockquote type="cite"
cite="mid:k1sEVFr4T-I-lsySXq-bIaHoRR89SeXeb319-ibmwyWCPTTGwvmjWT5MLyC61oPEZW4K5jZYiuYxvI54XbefF3ABuRIwlvlLKgSeclcMBLk=@protonmail.com">
<div style="font-family: arial; font-size: 14px;">
<div style="font-family: arial; font-size: 14px;"><br>
</div>
<div style="font-family: arial; font-size: 14px;">I am
attempting to project and transform geometry using OSR. The
projection/transformation is from ITRF2014 via Proj4 string to
NAD83(CSRS)v7 (EPSG:8255). My problem is that I need the
transformation output to match the output I receive when
transforming the geometry in ESRI using the geometry.projectAs
function. It seems that the OSR transformation creates a
point that is always shifted from the ESRI geometry. Any
advice on how to match projections and transformations between
open source and ESRI would be extremely helpful.</div>
<div style="font-family: arial; font-size: 14px;"><br>
</div>
<div style="font-family: arial; font-size: 14px;">Original
coordinate: -74.442799450000, 41.406811727778<br>
</div>
<div style="font-family: arial; font-size: 14px;"> <br>
</div>
</div>
<div style="font-family: arial; font-size: 14px;">ESRI point after
transform: -74.4427951819612, 41.4068026527349<br>
</div>
<div style="font-family: arial; font-size: 14px;"><br>
</div>
<div style="font-family: arial; font-size: 14px;">OGR point after
transform: -74.44281012167299, 41.40671904426617<br>
</div>
<div style="font-family: arial; font-size: 14px;">
<div style="font-family: arial; font-size: 14px;"><br>
</div>
<div style="font-family: arial; font-size: 14px;">Code used to
generate the OGR point:<br>
</div>
</div>
</blockquote>
<p>You've likely used the coordinate order wrong. GDAL 3 honours by
default authority (EPSG) axis order, so for EPSG this means
lat/lon for geographic CRS.</p>
<p>So either switch your coordinate, or call
itrf.SetAxisMappingStrategy(osr.OAMS_TRADITIONAL_GIS_ORDER) and
to_nad.SetAxisMappingStrategy(osr.OAMS_TRADITIONAL_GIS_ORDER)</p>
<p>With that, you'll get the same results as Esri software</p>
<p>>>> print(outpoint)<br>
POINT (-74.442810121673 41.4067190442662 0)<br>
<br>
</p>
<p>Even<br>
</p>
<blockquote type="cite"
cite="mid:k1sEVFr4T-I-lsySXq-bIaHoRR89SeXeb319-ibmwyWCPTTGwvmjWT5MLyC61oPEZW4K5jZYiuYxvI54XbefF3ABuRIwlvlLKgSeclcMBLk=@protonmail.com">
<pre style="margin-top: 0px; margin-right: 0px; margin-bottom: calc(var(--s-prose-spacing) + 0.4em); margin-left: 0px; padding: 12px; border: 0px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-variant-numeric: inherit; font-variant-east-asian: inherit; font-weight: 400; font-stretch: inherit; line-height: 1.30769; font-family: var(--ff-mono); font-size: 13px; vertical-align: baseline; box-sizing: inherit; width: auto; max-height: 600px; overflow: auto; background-color: var(--highlight-bg); border-radius: 5px; color: var(--highlight-color); overflow-wrap: normal; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" class="lang-py s-code-block"><code style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: inherit; font-size: 13px; vertical-align: baseline; box-sizing: inherit; background-color: transparent; white-space: inherit;" class="hljs language-python">itrf = osr.SpatialReference()
itrf.ImportFromProj4(<span style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; vertical-align: baseline; box-sizing: inherit; color: var(--highlight-variable);" class="hljs-string"><span class="font" style="font-family:inherit"><span class="size" style="font-size:13px">'GEOGCS["ITRF2014",DATUM["International_Terrestrial_Reference_Frame_2014",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433],AUTHORITY["EPSG",9000]]'</span></span></span>)
to_nad = osr.SpatialReference()
to_nad.ImportFromEPSG(<span style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; vertical-align: baseline; box-sizing: inherit; color: var(--highlight-namespace);" class="hljs-number"><span class="font" style="font-family:inherit"><span class="size" style="font-size:13px">8255</span></span></span>)
opts = osr.CoordinateTransformationOptions()
opts.SetOperation(<span style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; vertical-align: baseline; box-sizing: inherit; color: var(--highlight-variable);" class="hljs-string"><span class="font" style="font-family:inherit"><span class="size" style="font-size:13px">"ITRF2014_To_NAD_1983_CSRS_v7_7par"</span></span></span>)
transformer = osr.CreateCoordinateTransformation(itrf, to_nad, opts)
outpoint = ogr.Geometry(ogr.wkbPoint)
outpoint.AddPoint(*test_coords)
outpoint.AssignSpatialReference(itrf)
outpoint.Transform(transformer)</code>
</pre>
<div style="font-family: arial; font-size: 14px;">
<div style="font-family: arial; font-size: 14px;"><br>
</div>
<div>With ESRI I am using the ArcPy geometry function, projectAs
when taking in the name of a transformation. When ArcGIS
reprojects from ITRF2014 to NAD83(CSRS)v7 (EPSG:8255) with the
transformation "ITRF2014_To_NAD_1983_CSRS_v7_7par", a point is
generated ~30 ft away from the point generated by GDAL/OSR<br>
</div>
<div style="font-family: arial; font-size: 14px;"><br>
</div>
<div style="font-family: arial; font-size: 14px;">Code used to
generate the Esri point:<br>
</div>
</div>
<pre style="margin: 0px; padding: 12px; border: 0px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-variant-numeric: inherit; font-variant-east-asian: inherit; font-weight: 400; font-stretch: inherit; line-height: 1.30769; font-family: var(--ff-mono); font-size: 13px; vertical-align: baseline; box-sizing: inherit; width: auto; max-height: 600px; overflow: auto; background-color: var(--highlight-bg); border-radius: 5px; color: var(--highlight-color); overflow-wrap: normal; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" class="lang-py s-code-block"><code style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: inherit; font-size: 13px; vertical-align: baseline; box-sizing: inherit; background-color: transparent; white-space: inherit;" class="hljs language-python">ITRF_SPATIAL_REF = arcpy.SpatialReference(<span style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; vertical-align: baseline; box-sizing: inherit; color: var(--highlight-variable);" class="hljs-string"><span class="font" style="font-family:inherit"><span class="size" style="font-size:13px">'ITRF2014.prj'</span></span></span>)
NAD_SPATIAL_REF= arcpy.SpatialReference(<span style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; vertical-align: baseline; box-sizing: inherit; color: var(--highlight-namespace);" class="hljs-number"><span class="font" style="font-family:inherit"><span class="size" style="font-size:13px">8255</span></span></span>)
longitude = test_coords[<span style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; vertical-align: baseline; box-sizing: inherit; color: var(--highlight-namespace);" class="hljs-number"><span class="font" style="font-family:inherit"><span class="size" style="font-size:13px">0</span></span></span>]
latitude = test_coords[<span style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; vertical-align: baseline; box-sizing: inherit; color: var(--highlight-namespace);" class="hljs-number"><span class="font" style="font-family:inherit"><span class="size" style="font-size:13px">1</span></span></span>]
point = arcpy.Point(
longitude,
latitude
)
return_point = arcpy.PointGeometry(point, ITRF_SPATIAL_REF).projectAs(NAD_SPATIAL_REF, <span style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; vertical-align: baseline; box-sizing: inherit; color: var(--highlight-variable);" class="hljs-string"><span class="font" style="font-family:inherit"><span class="size" style="font-size:13px">"ITRF2014_To_NAD_1983_CSRS_v7_7par"</span></span></span>)</code>
</pre>
<div style="font-family: arial; font-size: 14px;">
<div style="font-family: arial; font-size: 14px;"><br>
</div>
<div style="font-family: arial; font-size: 14px;">Thank you for
your time,<br>
</div>
<div style="font-family: arial; font-size: 14px;">adamg<br>
</div>
<div style="font-family: arial; font-size: 14px;"><br>
</div>
<div style="font-family: arial; font-size: 14px;"
class="protonmail_signature_block">
<div class="protonmail_signature_block-proton">Sent with <a
rel="noopener noreferrer" href="https://protonmail.com/"
target="_blank" moz-do-not-send="true">ProtonMail</a>
Secure Email.</div>
</div>
</div>
<div style="font-family: arial; font-size: 14px;"><br>
</div>
<br>
<fieldset class="moz-mime-attachment-header"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
gdal-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/gdal-dev">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a>
</pre>
</blockquote>
<pre class="moz-signature" cols="72">--
<a class="moz-txt-link-freetext" href="http://www.spatialys.com">http://www.spatialys.com</a>
My software is free, but my time generally not.</pre>
</body>
</html>