QGIS-Processing-tools icon indicating copy to clipboard operation
QGIS-Processing-tools copied to clipboard

Any adjustments are needed for QGIS 3?

Open shaief opened this issue 6 years ago • 4 comments

Thanks for writing these scripts. What is needed in order to use them in QGIS 3?

shaief avatar Jun 25 '18 08:06 shaief

They have to be completely rewritten in Python 3 with the new Processing Scripts API, see https://anitagraser.com/2018/03/25/processing-script-template-for-qgis3/

anitagraser avatar Jun 25 '18 08:06 anitagraser

Hey Anita, it works wonderfully in 2.18. However, I am now trying to make it run in QGIS 3.6 and I am completely stuck. Can you please advice how to translate this bit:

writer = VectorWriter(output, None, [QgsField("order", QVariant.Int)], network_layer.dataProvider().geometryType(), network_layer.crs() )

Pyatkova avatar Jul 02 '19 13:07 Pyatkova

The above link contains the necessary code for writing output using a feature sink (that's a new concept that replaces the old writer).

However, since you are using QGIS 3.6, you can use a simpler version instead, which I've written about in https://anitagraser.com/2019/03/02/easy-processing-scripts-comeback-in-qgis-3-6/

anitagraser avatar Jul 02 '19 14:07 anitagraser

Hey Anita, Thanks a lot for your reply. I couldn't figure out how to use the decorators. As I was trying to snap GPS coordinates to streets, I decided maybe a more sophisticated method should be used. Now I am focusing on Offline Map-matching :)

Pyatkova avatar Jul 10 '19 14:07 Pyatkova