[Qgis-developer] Performing buffering with script in PyQGIS
marco.oliverio at libero.it
marco.oliverio at libero.it
Fri Aug 29 04:43:35 PDT 2014
I wrote a script that performs the intersection of two layers:
-the first Layer-> layer1 represents the rivers
-the second Layer-> layer2, represents a set of circular dots
distributed in a geographical area (at each point corresponds to a
numeric value that exceeds a threshold value)
The result of the intersection should be highlighted with an operation of buffering.
The new geometry formed by the intersection + buffering should look like this:
Writing from console PyQGIS I have not encountered any errors.
To see the new geometry I added new layers to the previous ones (from "add vector layer") but I have not seen anything new.
This is the code of my script:
from qgis.core import *
from qgis.gui import *
canvas = qgis.utils.iface.mapCanvas()
layers = canvas.layers()
layer1 = canvas.layer(0)
layer2 = canvas.layer(3)
from qgis.analysis import *
overlayAnalyzer = QgsOverlayAnalyzer()
overlayAnalyzer.intersection(layer1, layer2, "/home/..../Scrivania/..../output.shp")
layer3 = canvas.layer(0)
geometryanalyzer = QgsGeometryAnalyzer()
geometryanalyzer.buffer(layer3, "/home/..../Scrivania/..../buffer.shp", 500, False, False, -1)
Tips ?Also Demo & Plugin example that I can study
I'm working with QGIS 2.4 on Win 7
Thanks in advance
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20140829/36c42665/attachment.html>
More information about the Qgis-developer
mailing list