<div dir="ltr">Hi Team,<div><br></div><div>Just wondering whether I'm missing something or a genuine bug, please advise below. </div><div><br></div><div>All I am trying is, to take the geometry object in json format whose CRS is in WGS84 (EPSG:4326) and transform the geometry to EPSG:3857 CRS and eventually use it in further processing because rest of the processing is in EPSG:3857 CRS.</div><div><br></div><div>I have written below code and it works like a charm on Windows 10 but it doesn't transform the geometry on Linux. Please advise if there is anything wrong or missing to add.</div><div><b>Code Snippet for reproducing:</b></div><div><pre style="background-color:rgb(43,43,43);color:rgb(169,183,198);font-family:"JetBrains Mono",monospace;font-size:9.8pt"><span style="color:rgb(204,120,50)">from </span>qgis.PyQt.QtCore <span style="color:rgb(204,120,50)">import </span>QVariant<br><span style="color:rgb(204,120,50)">from </span>shapely.geometry <span style="color:rgb(204,120,50)">import </span>shape<br><span style="color:rgb(204,120,50)">import </span>geojson<span style="color:rgb(204,120,50)">,</span>json<br><span style="color:rgb(204,120,50)">from </span>qgis.core <span style="color:rgb(204,120,50)">import </span>(QgsGeometry<span style="color:rgb(204,120,50)">,</span>QgsCoordinateReferenceSystem<span style="color:rgb(204,120,50)">,</span>QgsCoordinateTransform<span style="color:rgb(204,120,50)">,</span>QgsProject)<br><span style="color:rgb(204,120,50)">from </span>shapely <span style="color:rgb(204,120,50)">import </span>speedups <span style="color:rgb(204,120,50)">as </span><span style="color:rgb(152,118,170);font-style:italic">sups<br></span>sups.disable()<br><br><span style="color:rgb(152,118,170);font-style:italic">in_geometry</span>=<span style="color:rgb(106,135,89)">'[{"type": "LineString","coordinates": [[-78.85338577199997,43.85845267000008],[-78.85593885699996,43.857924291000074]]}]'<br></span><span style="color:rgb(152,118,170);font-style:italic">geomjson </span>= json.loads(<span style="color:rgb(152,118,170);font-style:italic">in_geometry</span>)<br><span style="color:rgb(152,118,170);font-style:italic">old_crs </span>= QgsCoordinateReferenceSystem(<span style="color:rgb(106,135,89)">"EPSG:4326"</span>)<br><span style="color:rgb(152,118,170);font-style:italic">new_crs </span>= QgsCoordinateReferenceSystem(<span style="color:rgb(106,135,89)">"EPSG:3857"</span>)<br><span style="color:rgb(152,118,170);font-style:italic">xtransform </span>= QgsCoordinateTransform(<span style="color:rgb(152,118,170);font-style:italic">old_crs</span><span style="color:rgb(204,120,50)">, </span><span style="color:rgb(152,118,170);font-style:italic">new_crs</span><span style="color:rgb(204,120,50)">, </span>QgsProject.instance())<br><span style="color:rgb(204,120,50)">for </span><span style="color:rgb(152,118,170);font-style:italic">i</span><span style="color:rgb(204,120,50)">, </span><span style="color:rgb(152,118,170);font-style:italic">g </span><span style="color:rgb(204,120,50)">in </span><span style="color:rgb(136,136,198)">enumerate</span>(<span style="color:rgb(152,118,170);font-style:italic">geomjson</span>):<br>    <span style="color:rgb(152,118,170);font-style:italic">s </span>= json.dumps(<span style="color:rgb(152,118,170);font-style:italic">g</span>)<br>    <span style="color:rgb(152,118,170);font-style:italic">g1 </span>= geojson.loads(<span style="color:rgb(152,118,170);font-style:italic">s</span>)<br>    <span style="color:rgb(152,118,170);font-style:italic">shapely_geom </span>= shape(<span style="color:rgb(152,118,170);font-style:italic">g1</span>)<br>    <span style="color:rgb(152,118,170);font-style:italic">qgs_geom</span>=QgsGeometry.fromWkt(<span style="color:rgb(152,118,170);font-style:italic">shapely_geom</span>.wkt)<br>    <span style="color:rgb(152,118,170);font-style:italic">qgs_geom</span>.transform(<span style="color:rgb(152,118,170);font-style:italic">xtransform</span>)<br>    <span style="color:rgb(136,136,198)">print </span>(<span style="color:rgb(152,118,170);font-style:italic">qgs_geom</span>)</pre></div><div><b>Output from Pycharm:</b></div><div>C:\Qgis\apps\Python37\python.exe C:/_WORK/SERVICE/test_transform.py<br><QgsGeometry: LineString (-8777918.77684544585645199 5443563.52439526654779911, -8778202.97550544328987598 5443481.85537817236036062)><br><br>Process finished with exit code 0<br></div><div><br></div><div><b>Output from Linux terminal:</b></div><div>(gisenv) admin@rd-temp-server:~/gis_service$ python3 test_transform.py<br></div><div>Application path not initialized<br>Application path not initialized<br><QgsGeometry: LineString (-78.85338600000000042 43.85845299999999725, -78.85593900000000644 43.85792399999999702)><br>(gisenv) admin@rd-temp-server:~/gis_service$<br></div><div><br></div><div>Thanks.</div><div>-Prem</div></div>