TransWikia.com

PyQGIS algorithm qgis:joinattributesbynearest not found

Geographic Information Systems Asked by Tom3 on August 4, 2021

After re-installing Windows and QGIS 3.14 it seems like some PyQGIS algorithms are not working. For example:

processing.run("qgis:joinattributesbynearest", options)

gives

core.QgsProcessingException: Error: Algorithm qgis:joinattributesbynearest not found

I checked the algorithm ID in the latest docs, and it is correct.

For troubleshooting, I created a list of all available algorithms using

for alg in QgsApplication.processingRegistry().algorithms():
    print(alg.id(), "->", alg.displayName())

This results in quite a long file to share here but nowhere in the file I can find the algorithm name or identifier.

Note that the algorithm is available via the Processing Toolbox in the GUI, so I wonder where the PyQGIS version is hiding.

One Answer

Found the solution. Turned out that the algorithm_id from documentation is not correct, as hovering over the algorithm name in the QGIS Processing Toolbox revealed that the algorithm is named: 'native:joinbynearest'. Didn't know that trick before so I always looked up the algorithm_id in the online documentation.

Answered by Tom3 on August 4, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP