2

According to Using QGIS3 Processing algorithms from standalone PyQGIS scripts (outside of GUI) I try to implement the existing "Split Lines with Lines" algorithm into a QGIS Plugin.

To do this I need the path, where the algorithm file is stored, but I do not manage to find it. Can you tell me where it is stored and if there is an easy way to find out, where algorithms are stored?

  • C:\OSGeo4W64\apps\qgis\python\plugins\processing\algs\saga\description\SplitLineswithLines.txt – neogeomat Oct 24 '18 at 19:34
  • Ok I found that one too. But is it the actual algorithm? Since it contains no code, I thought it's just metadata or something. – gHupf Oct 24 '18 at 20:52
  • I think the codes are inside the files out of that folders, but I couldn't find them. Maybe you can open the folders in a text editor and perform a folder wide search. – neogeomat Oct 25 '18 at 16:58
0

To use the processing module in a stand-alone Python script, I execute this code:

import sys

# qgis
import qgis.core
import PyQt5.QtCore
import gdal
import qgis.PyQt.QtCore

# for function gdal_merge
sys.path.append(r'C:\OSGeo4W64\bin')
import gdal_merge

# initializing processing module
qgis.core.QgsApplication.setPrefixPath(r'C:\OSGeo4W64\apps\qgis', True)
qgs = qgis.core.QgsApplication([], False)
qgs.initQgis()
sys.path.append(r'C:\OSGeo4W64\apps\qgis\python\plugins')
import processing
processing.core.Processing.Processing.initialize()
qgis.core.QgsApplication.processingRegistry().addProvider(qgis.analysis.QgsNativeAlgorithms())

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.