New answers tagged

4

Saving this in a Python file and using it in the --code arg should do what you need: from PyQt4.QtCore import * from PyQt4.QtGui import * import os from qgis.core import * from qgis.gui import * from qgis.utils import iface for comp in iface.activeComposers(): print comp folder = r"C:\temp" title = "testing" printer = QPrinter() ...


4

## Iterate through each of the buildings That should be a single comment sign (#), not a double one, otherwise, it tries to parse it as if it was a parameter, and it fails BTW, you do not need to add the script from file. Just save it to the scripts folder, and it will be automatically added to the toolbox Hope this helps!


0

For QGIS 2.8.2 with Processing plugin 2.9.0: processing.runalg("qgis:joinattributesbylocation", layer1, layer2, u'contains', 1, 'sum', 1, None) For QGIS 2.12.2 with Processing plugin 2.12.2: processing.runalg("qgis:joinattributesbylocation", layer1, layer2, u'contains', 0, 1, 'sum', 1, None) (note the extra parameter for "precision")


1

zoneStat = QgsZonalStatistics (polygonLayer, rasterFilePath, 'pre-', 1) zoneStat.calculateStatistics(None) calculates by default just Count, Sum and Mean (as you can tell from Raster -> Zonal Statistics in QGIS Desktop, it can do a lot more). If you, for instance, want to compute just the Mean you have to use: zoneStat = QgsZonalStatistics ...


1

I think I understand now. Let me know if this is not what you're looking for. >>> import subprocess >>> p = subprocess.Popen(['v.in.ascii', 'input=/home/username/Desktop/temp.txt', 'output=raster_pnts','x=1','y=2','fs=\',\'','--o'],stdout=subprocess.PIPE, stderr=subprocess.PIPE) >>> stdoutdata, stderrdata = p.communicate() ...



Top 50 recent answers are included