[Qgis-developer] Chain Temporary Algorithms

bjorn.burr.nyberg at gmail.com bjorn.burr.nyberg at gmail.com
Fri Jul 26 20:59:59 PDT 2013


Hej Everyone,
New to the mailing list here... and I am having some trouble writing a
script that I was hoping someone could lend me a hand with. Mainly this is a
script I use to get centerline's of a polygon that I used in ArcGIS before
and I want to adapt it to work in QGIS. Anyways there are a sequence of
algorithms from qgis that I want to use in memory before getting the final
output as a series of points (which then need to be processed further)
however chaining these algorithms simply fails after the first one where the
output is simply not being created for the next step to process.

Here is a snippet of that code - any help would be appreciated!
Cheers,
Bjorn

#Definition of inputs and outputs
#==================================
##[Example scripts]=group
##Polygon=vector
##Detail=number 1000
##Scale=boolean True
##All_Paths=boolean False
##Output=output vector

#Algorithm body
#==================================
import sextante as st
    
densify = st.runalg("qgis:densifygeometries"),inFC,Detail,None)
extractNodes = st.runalg("qgis:extractnodes",densify,None)
voronoi = st.runalg("qgis:voronoipolygons",extractNodes,None)
voronoi_lines = st.runalg("qgis:polygonstolines",voronoi,None)
polygon_lines = st.runalg("qgis:polygonstolines",inFC,None)
clip = st.runalg("qgis:clip",inFC,voronoi_lines,None)
out = st.runalg("qgis:difference",clip,polygon_lines,None)

layer = st.getobject(out)
features: = st.getfeatures(layer)
Points = []
for feature in features:
    Points.append(features.geometry().asMultiPolyline())



--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Chain-Temporary-Algorithms-tp5069057.html
Sent from the Quantum GIS - Developer mailing list archive at Nabble.com.


More information about the Qgis-developer mailing list