Created
February 26, 2020 12:33
-
-
Save ThomasG77/71def7a758bfa75425d5bc87dde68906 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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