<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p><span style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;">Hi all,</span><br>
</p>
<div style="color: rgb(0, 0, 0);">
<div>
<div id="divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:#000000; font-family:Calibri,Helvetica,sans-serif">
<p><br>
</p>
<p>I am currently using the "Snap to Roads" script inside my qgis environment, to match gpx-points to the OSM (<a href="https://spatialthoughts.com/2020/02/22/snap-to-roads-qgis-and-osrm/" class="OWAAutoLink">https://spatialthoughts.com/2020/02/22/snap-to-roads-qgis-and-osrm/</a>).</p>
<p> </p>
<p>I am able to execute the Script by using the QGIS Script Environment:</p>
<p><img naturalheight="527" naturalwidth="609" size="25278" id="img822988" tabindex="0" style="max-width: 99.9%; user-select: none;" src="cid:317d9d57-3f6d-41dd-8234-b68dcfa66fc2"><br>
</p>
<p><br>
</p>
<p>Unfortunatly, I would like to run the script via python console inside QGiS, but this doesn't work at all ... </p>
<p><br>
</p>
<p>By executing the following command: </p>
<p><br>
</p>
<p></p>
<div>layer_SnappedLine = processing.run("script:snap_to_roads", </div>
<div>{'INPUT':layer_GPX_Points['OUTPUT'],</div>
<div>'SERVICE':'http://127.0.0.1:5000',</div>
<div>'TOLERANCE':10,</div>
<div>'OUTPUT':'TEMPORARY_OUTPUT'})</div>
<br>
<p></p>
<p>I receive the error message: </p>
<p>"<span style="font-size:12pt; color:rgb(255,0,0)">Traceback (most recent call last):</span></p>
<div><span style="color:rgb(255,0,0)">  File "C:\PROGRA~1\QGIS32~1.10\apps\Python39\lib\code.py", line 90, in runcode</span></div>
<div><span style="color:rgb(255,0,0)">    exec(code, self.locals)</span></div>
<div><span style="color:rgb(255,0,0)">  File "<input>", line 1, in <module></span></div>
<div><span style="color:rgb(255,0,0)">  File "C:\PROGRA~1/QGIS32~1.10/apps/qgis-ltr/./python/plugins\processing\tools\general.py", line 108, in run</span></div>
<div><span style="color:rgb(255,0,0)">    return Processing.runAlgorithm(algOrName, parameters, onFinish, feedback, context)</span></div>
<div><span style="color:rgb(255,0,0)">  File "C:\PROGRA~1/QGIS32~1.10/apps/qgis-ltr/./python/plugins\processing\core\Processing.py", line 205, in runAlgorithm</span></div>
<div><span style="color:rgb(255,0,0)">    layer = context.takeResultLayer(result)  # transfer layer ownership out of context</span></div>
<div><span style="color:rgb(255,0,0)">TypeError: QgsProcessingContext.takeResultLayer(): argument 1 has unexpected type 'QgsFeatureSink</span>'<span style="font-size:12pt">"</span></div>
<div><span style="font-size:12pt"><br>
</span></div>
<div><span style="font-size:12pt">Can anybody help me with this issue? I am using QGIS Version 3.22.10</span></div>
<div><span style="font-size:12pt"><br>
</span></div>
<div>Regards and thanks,</div>
<div>Marie</div>
<p></p>
</div>
</div>
</div>
</div>
</body>
</html>