Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
import sys
import os
import qgis
from qgis.gui import *
from qgis.core import *
from qgis.utils import plugins
from PyQt5.QtCore import *
quickosm = os.path.join(os.environ['HOME'], '.local/share/QGIS/QGIS3/profiles/default/python/plugins/')
sys.path.append(quickosm)
processingroot = '/usr/share/qgis/python/plugins/'
sys.path.append(processingroot)
from QuickOSM.quick_osm_processing.provider import Provider
# QgsApplication.setPrefixPath("C:\\OSGeo4W64\\apps\\qgis\\", True)
qgis_application = QgsApplication([], True)
qgis_application.initQgis()
qg_project = QgsProject.instance()
from qgis.analysis import QgsNativeAlgorithms
import processing
from processing.core.Processing import Processing
Processing.initialize()
QgsApplication.processingRegistry().addProvider(QgsNativeAlgorithms())
QgsApplication.processingRegistry().addProvider(Provider())
# The extent is calculated somewhere else
alg_params = {'EXTENT': [0.5, 0.51, 44.01, 44.02],
'KEY': '',
'SERVER': 'http://www.overpass-api.de/api/interpreter',
'TIMEOUT': 25,
'VALUE': ''
}
for alg in QgsApplication.processingRegistry().algorithms():
print(alg.id(), "->", alg.displayName())
feedback = QgsProcessingFeedback()
# Failed here as algs from quickosm are not registered well.
# but the why? Deduction from previous print as it shows the following:
# qgis:voronoipolygons -> Voronoi polygons
# : ->
# : ->
# : ->
# : ->
# : ->
# : ->
outputs['BuildQueryInsideAnExtent'] = processing.run('quickosm:buildqueryextent', alg_params, feedback)
qgs.exitQgis()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.