1

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?

Taras
35.7k5 gold badges77 silver badges151 bronze badges
asked Aug 24, 2020 at 10:49

1 Answer 1

1
>>> 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:

answered Aug 24, 2020 at 11:49

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.