New answers tagged

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")


3

Steven Kays answer in pyqgis. Just select the lines in your layer before running the script. The script does not support the linemerging so it can not work on layer with multilinestring #!python # coding: utf-8 # https://gis.stackexchange.com/questions/173127/generating-equal-sized-polygons-along-line-with-pyqgis from qgis.core import QgsMapLayerRegistry, ...


1

This error ImportError: cannot import name QPyNullVariant It indicates that the SIP API version is not set to version 2. When you write standalone python scripts, make sure that the very first import is import qgis The SIP API Version always needs to be set before any other PyQt code is executed. The qgis import takes care of that.


3

If you select your features before running the Field Calculator in the modeler, the output will contain only those selected features. A workaround would be to use a custom script in your model which allows you to update your selected features within the same layer. To do this, go to Processing Toolbox > Scripts > Tools > Create new script and copy the ...


1

Assuming you have a regular collection of tiles, distributed in two dimensions like a grid, and your mosaic function only takes pairs of images to produce a new concatenated image, there are four ways to compile a mosaic: Random order Row-major order Column-major order Hybrid row-major With random order, the target image will get large fast, with large ...


2

The latest versions of the Processing plugin (from 2.10 onwards) contains a couple of errors in the code for the Frequency Analysis tool. You can manually update the tool (located in C:\Users\You\.qgis2\python\plugins\processing\algs\qgis\scripts) or create a new script and use the following code, which is directly taken from the tool, but includes the ...


3

If I use your code, I can't get it to run (I think it's because I have to define the minimum extent of the layer manually). The following works for me: import processing layer = "C:\Users\Me\Desktop\Test\\line example.shp" extent = QgsVectorLayer( layer, '', 'ogr' ).extent() xmin = extent.xMinimum() xmax = extent.xMaximum() ymin = extent.yMinimum() ymax = ...



Top 50 recent answers are included