TransWikia.com

Using NNJoin-Plugin through Python console

Geographic Information Systems Asked on October 21, 2020

I want to write a Python script which I can execute from within QGIS 2.18 (from the Python console).

The Python script should calculate the nearest line (out of a set of lines) of a given point (out of a set of points) and I have already accomplished this task by manually using the NNJoin-Plugin. Now I want to automize this process within a python script, but I do not know how to run the NNJoin plugin within a Python script.

Is this even possible? If yes, could you give me some advice on how to accomplish this?

One Answer

>>> from qgis import utils
>>> theplugin = utils.plugins['NNJoin']
>>> dir(theplugin)

That will give you

['NNJOIN', 'NNJOINAMP', '__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', 'dlg', 'iface', 'initGui', 'nnj_action', 'plugin_dir', 'run', 'toolbar', 'tr', 'unload']

References:

Correct answer by Taras on October 21, 2020

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