New answers tagged

1

You can use None as output parameter. Doing so, QGIS Processing creates a temporary vector file for you: processing.runandload("qgis:createpointsalonglines", "Clipped" ,100,0,0,None) Or: res = processing.runalg("qgis:createpointsalonglines", "Clipped" ,100,0,0,None) iface.addVectorLayer(res['output'],'my points','ogr') In my case (on a GNU/Linux), the ...


2

You can actually do both (add a field and write values in it) using a single QGIS Processing algorithm: processing.runalg('qgis:fieldcalculator', metro_roads, 'STRNAME', 2, 20, 0, True, "concat('This is row # ', $rownum)", path+"Metro_roads_new.shp") This is what each parameter means: processing.runalg('qgis:fieldcalculator', input_layer, field_name, ...


1

Even though you're running the QGIS Desktop with GRASS the GRASS plugin is not on by default, you have to go to Plugins -> Manage and Install... then to the installed plugins. There you'll find an entry for GRASS 7, check its box and then you'll have the GRASS tools under the plugin menu. If you don't have the GRASS 7 entry in the installed plugins go back ...


1

Have a look under Processing > Options if GDAL/OGR is activated. Which version of Processing do you have installed? It should be at 2.12.2 now I think...


2

Have you tried to search of Raster Calculator in the processing toolbox? It should be under GDAL -> Miscellaneous. Also under SAGA -> Grid - Calculus. Make sure you select the advanced interface.


1

You could use something like the following: import processing lddLrs = qgis.utils.iface.legendInterface().layers() path = "path/to/results//" for lyr in lddLrs: processing.runalg("saga:rastercalculator", lyr, None, "(a/a)*a", True, 7, path + lyr.name() + "_suffix.tif") EDIT : If you want to use the QgsRasterCalculator, you could try using the ...


3

This is being caused by a bug with QGis. I am trying the r.sum GRASS module that is listed in the Processing toolbox list. However, this module was deprecated in GRASS 7 and replaced by r.univar. Looking closer at the module dialogue, there is actually an error message about it: Back to the GRASS shell then.


3

The Results Viewer is used if the algorithm outputs texts or graphics as described here. So if you use multiple algorithms showing, for example, some basic statistics, the results viewer would contain those statistics for each layer. Also, if you want to keep the dialogue open, you can enable the setting: Processing > Options... > General > Keep ...


0

You're close! You might be receiving errors because when you run code from the script, you need to import the relevant modules for the code to run. QGIS loads most of these at startup but the scripts are externally run. Modifying your code slightly, you could use: ##Example=name from qgis.core import QgsVectorLayer, QgsMapLayerRegistry vectorLyr = ...


2

Thanks to BradHards and ThomasG77 who sent link for interpolation code. This is what I meant: import qgis.analysis layer = QgsVectorLayer(pathToFile, 'nameOfLayer','ogr') ld1 = qgis.analysis.QgsInterpolator.LayerData() ld1.vectorLayer = layer ld1.zCoordInterpolation=False ld1.InterpolationAttribute = 7 #column index, start with 0 ld1.mInputType = 1 ...


1

If you have a partitioned drive you can make your life easy by working from the "D"-drive or whatever, as paths originating from there donĀ“t contain your username.


3

Ensure the identifier field in both files are the same type. That is make sure they're both text or both numeric.


0

I remember that I tried to change the directory for r-scipts in QGIS. I changed it into a location on an external hard drive. I ran QGIS without the hard drive linked to my PC and QGIS produced the same error like yours, Zach. After connecting the hard drive again, QGIS produced no error while starting and I could change the directory to the old path again: ...



Top 50 recent answers are included