I wrote the following code to start using QGIS APIs. in a very short script seen below, the "Error: Algorithm not found" is thrown and "print processing.alglist()" is showing none. Any idea why this is happening?
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from qgis.core import *
from qgis.gui import *
import nltk
import sys, os
import shapely
import math
from collections import defaultdict
from shapely.geometry import LineString
import json
import datetime
import time
import itertools
import glob
import sys
app = QApplication(sys.argv)
qgis_prefix = "C:/Program Files/QGIS Valmiera/apps/qgis"
QgsApplication.setPrefixPath(qgis_prefix, True)
QgsApplication.initQgis()
layer1 = QgsVectorLayer("D:/Ehsan/Test/InputData/SHP/OSM_roads_no_psv_latin1_id.shp", "test" , "ogr")
if not layer1.isValid():
print "Layer failed to load! :("
print layer1.isValid()
import processing
processing.alglist()
processing.runalg("qgis:clip","D:/Ehsan/Test/InputData/SHP/OSM_roads_no_psv_latin1_id.shp","D:/Ehsan/Test/InputData/temporary/tmpotile.shp","D:/Ehsan/Test/LM_Feat_test.shp")
Notice: the imports list is to show that I have almost everything imported and added to the path and pythonpath...
Please help me to figure out how to resolve it. So far, the QGIS has seemed to be so buggy and problematic outside its python console. @Lukas Graf
No comments:
Post a Comment