Python API#

To use HedgeTools python API you should have an environment with qgis python bindings enable. If not a tutorial is available in the installation page.

Once the environment created you need to add the location of HedgeTools to your path and you can import the API.

Note

If you installed HedgeTools with QGIS you will find it within QGIS with : Settings > User Profiles > Open Active Profile Folder Then in the new window : python > plugins

import sys
import platform
sys.path.append(".../python/plugins/")
from hedge_tools.hedgetools_app import HedgeToolsApp

# HedgeToolsApp may need to access the processing library
# Usually it can be found in the following path :
if platform == "linux":
    processing_path = "/usr/share/qgis/python/plugins"
elif platform == "win32":
    processing_path = r"C:\OSGeo4W\apps\qgis-ltr\python\plugins\processing"

debug_mode = False
app = HedgeToolsApp(processing_path, use_canvas=True, debug_mode=debug_mode)

Table of Contents