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
  • 32,823
  • 4
  • 66
  • 137
applebrown
  • 725
  • 7
  • 24

1 Answers1

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:

Taras
  • 32,823
  • 4
  • 66
  • 137