<!doctype html>
<html>
<head>
<meta charset="UTF-8">
</head>
<body>
<p class="default-style"> </p>
<p class="MsoNormal" style="font-family: Calibri, sans-serif; margin: 0cm 0cm 0.0001pt; font-size: 11pt;">Hy all,</p>
<p class="default-style MsoNormal" style="font-family: Calibri, sans-serif; margin: 0cm 0cm 0.0001pt; font-size: 11pt;">I will try again with my question:</p>
<p class="MsoNormal" style="font-family: Calibri, sans-serif; margin: 0cm 0cm 0.0001pt; font-size: 11pt;">I simply try to convert a point from local Cartesian ENU centered on a point with lat,lon coordinates to geocentric ECEF coordinates.</p>
<p class="MsoNormal" style="font-family: Calibri, sans-serif; margin: 0cm 0cm 0.0001pt; font-size: 11pt;">With proj from command line all works well. I use strings from proj to create QGIS CRS, and it seems all works well, i receive true in return code.</p>
<p class="MsoNormal" style="font-family: Calibri, sans-serif; margin: 0cm 0cm 0.0001pt; font-size: 11pt;">But when i try to convert i receive I receive:</p>
<p class="MsoNormal" style="font-family: Calibri, sans-serif; margin: 0cm 0cm 0.0001pt; font-size: 11pt;">Error transforming "forward transform of\n (inf,inf)\n Error: Fallback transformation failed"</p>
<p class="MsoNormal" style="font-family: Calibri, sans-serif; margin: 0cm 0cm 0.0001pt; font-size: 11pt;"> </p>
<p class="MsoNormal" style="font-family: Calibri, sans-serif; margin: 0cm 0cm 0.0001pt; font-size: 11pt;"> </p>
<p class="MsoNormal" style="font-family: Calibri, sans-serif; margin: 0cm 0cm 0.0001pt; font-size: 11pt;">Is there any issues in qgis 3.22 LTS ?</p>
<p class="MsoNormal" style="font-family: Calibri, sans-serif; margin: 0cm 0cm 0.0001pt; font-size: 11pt;"> </p>
<p class="MsoNormal" style="font-family: Calibri, sans-serif; margin: 0cm 0cm 0.0001pt; font-size: 11pt;">This is C++ code.</p>
<p class="MsoNormal" style="font-family: Calibri, sans-serif; margin: 0cm 0cm 0.0001pt; font-size: 11pt;"> </p>
<p class="MsoNormal" style="font-family: Calibri, sans-serif; margin: 0cm 0cm 0.0001pt; font-size: 11pt;"> </p>
<p class="MsoNormal" style="font-family: Calibri, sans-serif; margin: 0cm 0cm 0.0001pt; font-size: 11pt;">void geoutils::TopoToECEF(const QgsPointXY &origin, const QgsPointXY &point, QgsPointXY &point_wgs)</p>
<p class="MsoNormal" style="font-family: Calibri, sans-serif; margin: 0cm 0cm 0.0001pt; font-size: 11pt;">{</p>
<p class="MsoNormal" style="font-family: Calibri, sans-serif; margin: 0cm 0cm 0.0001pt; font-size: 11pt;"> </p>
<p class="MsoNormal" style="font-family: Calibri, sans-serif; margin: 0cm 0cm 0.0001pt; font-size: 11pt;"> try {</p>
<p class="MsoNormal" style="font-family: Calibri, sans-serif; margin: 0cm 0cm 0.0001pt; font-size: 11pt;"> </p>
<p class="MsoNormal" style="font-family: Calibri, sans-serif; margin: 0cm 0cm 0.0001pt; font-size: 11pt;"> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr>QgsCoordinateReferenceSystem geocentricCRS;</p>
<p class="MsoNormal" style="font-family: Calibri, sans-serif; margin: 0cm 0cm 0.0001pt; font-size: 11pt;"> </p>
<p class="MsoNormal" style="font-family: Calibri, sans-serif; margin: 0cm 0cm 0.0001pt; font-size: 11pt;"> QString projStringGeocentric = "+proj=cart +ellps=GRS80"; //ECEF CRS</p>
<p class="MsoNormal" style="font-family: Calibri, sans-serif; margin: 0cm 0cm 0.0001pt; font-size: 11pt;"> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> bool res= geocentricCRS.<wbr>createFromProj(<wbr>projStringGeocentric)<wbr>;<wbr></p>
<p class="MsoNormal" style="font-family: Calibri, sans-serif; margin: 0cm 0cm 0.0001pt; font-size: 11pt;"> qDebug() << "result 1 is " << res << geocentricCRS.toProj(); // this return true !!!</p>
<p class="MsoNormal" style="font-family: Calibri, sans-serif; margin: 0cm 0cm 0.0001pt; font-size: 11pt;"> </p>
<p class="MsoNormal" style="font-family: Calibri, sans-serif; margin: 0cm 0cm 0.0001pt; font-size: 11pt;"> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr>QgsCoordinateReferenceSystem topocentricCRS;</p>
<p class="MsoNormal" style="font-family: Calibri, sans-serif; margin: 0cm 0cm 0.0001pt; font-size: 11pt;"> </p>
<p class="MsoNormal" style="font-family: Calibri, sans-serif; margin: 0cm 0cm 0.0001pt; font-size: 11pt;"> QString projStringTopocentric = "+proj=topocentric +ellps=WGS84";</p>
<p class="MsoNormal" style="font-family: Calibri, sans-serif; margin: 0cm 0cm 0.0001pt; font-size: 11pt;"> projStringTopocentric += " +lon_0=9"; // origin lon</p>
<p class="MsoNormal" style="font-family: Calibri, sans-serif; margin: 0cm 0cm 0.0001pt; font-size: 11pt;"> projStringTopocentric += " +lat_0=44"; // origin lat</p>
<p class="MsoNormal" style="font-family: Calibri, sans-serif; margin: 0cm 0cm 0.0001pt; font-size: 11pt;"> projStringTopocentric += " +h_0=0 +units=m"; //</p>
<p class="MsoNormal" style="font-family: Calibri, sans-serif; margin: 0cm 0cm 0.0001pt; font-size: 11pt;"> </p>
<p class="MsoNormal" style="font-family: Calibri, sans-serif; margin: 0cm 0cm 0.0001pt; font-size: 11pt;"> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr>res = topocentricCRS.<wbr>createFromProj(<wbr>projStringTopocentric)<wbr>;<wbr></p>
<p class="MsoNormal" style="font-family: Calibri, sans-serif; margin: 0cm 0cm 0.0001pt; font-size: 11pt;"> </p>
<p class="MsoNormal" style="font-family: Calibri, sans-serif; margin: 0cm 0cm 0.0001pt; font-size: 11pt;"> qDebug() << "result 2 is " << res << topocentricCRS.toProj(); //this return true !!!</p>
<p class="MsoNormal" style="font-family: Calibri, sans-serif; margin: 0cm 0cm 0.0001pt; font-size: 11pt;"> </p>
<p class="MsoNormal" style="font-family: Calibri, sans-serif; margin: 0cm 0cm 0.0001pt; font-size: 11pt;"> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr>QgsProject:<wbr>:<wbr>instance(<wbr>)<wbr>->setCrs(<wbr>geocentricCRS)<wbr>;<wbr></p>
<p class="MsoNormal" style="font-family: Calibri, sans-serif; margin: 0cm 0cm 0.0001pt; font-size: 11pt;"> </p>
<p class="MsoNormal" style="font-family: Calibri, sans-serif; margin: 0cm 0cm 0.0001pt; font-size: 11pt;"> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr>QgsCoordinateTransform *xformerFromTopocentricToGeoce<wbr>ntric = new QgsCoordinateTransform(<wbr>topocentricCRS,<wbr> geocentricCRS, QgsProject::instance()); <wbr> // src, dest, proj</p>
<p class="MsoNormal" style="font-family: Calibri, sans-serif; margin: 0cm 0cm 0.0001pt; font-size: 11pt;"> </p>
<p class="MsoNormal" style="font-family: Calibri, sans-serif; margin: 0cm 0cm 0.0001pt; font-size: 11pt;"> qDebug() << "TopoToECEF Input point x: " << point.x() << " y: "<< point.y();</p>
<p class="MsoNormal" style="font-family: Calibri, sans-serif; margin: 0cm 0cm 0.0001pt; font-size: 11pt;"> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> point_wgs = xformerFromToTopocentricToWgs8<wbr>4->transform(point)<wbr>;<wbr> <wbr> // this BOOOMMMSS : forward transform of\n (inf,inf)\n Error: Fallback transformation failed</p>
<p class="MsoNormal" style="font-family: Calibri, sans-serif; margin: 0cm 0cm 0.0001pt; font-size: 11pt;"> </p>
<p class="MsoNormal" style="font-family: Calibri, sans-serif; margin: 0cm 0cm 0.0001pt; font-size: 11pt;"> qDebug() << "TopoToECEF - Output x: " << point_wgs.x() << " y: "<< point_wgs.y();</p>
<p class="MsoNormal" style="font-family: Calibri, sans-serif; margin: 0cm 0cm 0.0001pt; font-size: 11pt;"> </p>
<p class="MsoNormal" style="font-family: Calibri, sans-serif; margin: 0cm 0cm 0.0001pt; font-size: 11pt;"> } catch (const QgsException& e) {</p>
<p class="MsoNormal" style="font-family: Calibri, sans-serif; margin: 0cm 0cm 0.0001pt; font-size: 11pt;"> qDebug() << "error transforming " << e.what();</p>
<p class="MsoNormal" style="font-family: Calibri, sans-serif; margin: 0cm 0cm 0.0001pt; font-size: 11pt;"> </p>
<p class="MsoNormal" style="font-family: Calibri, sans-serif; margin: 0cm 0cm 0.0001pt; font-size: 11pt;"> }</p>
<p class="MsoNormal" style="font-family: Calibri, sans-serif; margin: 0cm 0cm 0.0001pt; font-size: 11pt;">}</p>
</body>
</html>