Questions tagged [qgis-processing]
Spatial data processing framework that brings advanced analysis capabilities to QGIS.
449
questions with no upvoted or accepted answers
12
votes
0
answers
361
views
Processing post-execution script hook to clear scratch layers?
I've been cobbling together some Processing scripts for QGIS 2.18 (I'm not a fan of QGIS 3 scripts), and I keep running into one particular problem: my script creates a lot of scratch layers and they ...
7
votes
0
answers
262
views
Increase tolerance of QGIS processing tools
I have 2 line layers in QGIS 3.22.0 and I
create a 10cm-buffer around line layer A (red)
perform a difference of line layer B (blue) with the buffer of layer A (light red)
As a result I get 1 ...
7
votes
0
answers
473
views
Programmatically Enable/disable input parameters in a QGIS Processing plugin
Is there a way to enable/disable a parameter by a checkbox in the processing interface? In my screenshot below, I would like to disable the Output Wall Aspect Raster when the Calculate wall aspect ...
6
votes
0
answers
680
views
qgis_process run script from command line
qgis_process allows us to run scripts already installed in QGIS from the command line. But is there a way to run qgis scripts not yet installed?
e.g. if I have a file script.py
from qgis.core import ...
6
votes
2
answers
721
views
Added raster layers with PyQGIS do not show up
I have a list ("datList") with names of raster layers which I want to add. When I add raster layers in the Python Console everything works fine:
for da in datListe:
layerDir = "C:/[...
6
votes
0
answers
323
views
Speeding up execution of PyQGIS algorithms
I don't understand why if I do "manually" some algorithms I get results much faster than when I insert the same in a PyQGIS code (with the same input).
This happens, for example, with the ...
6
votes
0
answers
499
views
Using attributes for output filenames in QGIS Process Modeler?
How can I use process inputs (eg: Table field) inside an expression for an output file when using Process modeler?
I have a process which outputs a raster, whose output filename should be the value ...
6
votes
0
answers
271
views
Activating GRASS utilities in QGIS Processing toolbox via text descriptors
This is a new follow-on question from this one. Following the documentation outlined in the answer, it is fairly easy to set up a descriptor text file for standard utilities that exist but aren't in ...
6
votes
0
answers
1k
views
QGIS: Release file lock on file used in a processing algorithm at the end of script
I am using runalg (qgis:joinattributesbylocation) on two QgsVectorLayer objects. At the end of my script I'm trying to delete all the files created during the script. I can delete everything except ...
5
votes
0
answers
166
views
Changing feature attribute just after adding via QgsFeatureSink
How can I access a feature and change its attribute value, I just added to a processing-output before via sink.addFeature(feature, QgsFeatureSink.FastInsert)?
Things like feature.id(specificfeatid)[...
5
votes
0
answers
156
views
Passing list as reclassify input table parameter in qgis.reclassifybytable algorithm
Following up on Save and load the classes definition table in the QGIS reclassify by table tool, I decided to run the qgis.reclassifybytable algorithm using PyQGIS to reclassify an aspect raster.
Here'...
5
votes
0
answers
210
views
QGIS processing tools - saving/exporting graph
I just tried QGIS processing tools for the first time.
When using shortest path search for the first time, the algorithm is building a path graph (of course). However, the graph is never re-used. ...
5
votes
0
answers
1k
views
Selecting and deselecting features with PyQGIS
I'm trying to apply the algorithms "Random Points along Lines" at the feature level. I did some PyQGIS code to iterate through the features to select each individual instance and apply the algorithm ...
5
votes
0
answers
132
views
How to use the output of one run as input to the next in QGIS batch processing?
I'm trying to do a series of buffers using the processing batch interface, and I want to use the output of the first run as the input to the second (and so on). But I can only pick an existing file or ...
5
votes
0
answers
296
views
Creating QGIS processing algorithm that works asynchronously?
I am writing a QGIS processing algorithm that reads rows including addresses from a CSV file. The addresses are geocoded one by one via external REST API and then a vector layer containing the point ...
5
votes
0
answers
126
views
Zonal statistics behavior
I have an issue for the result of QGIS Zonal statistics mean values.
I expect the value for the polygon marked red (poquoson) is about 26.6 but it seems that it is averaged value over one right ...
5
votes
1
answer
1k
views
r.viewshed Raster map not found
I wanted to test the r.viewshed module from grass via the Toolbox in QGis. But no File is generated. This is the log output:
Algorithm r.viewshed - Computes the viewshed of a point on an elevation ...
5
votes
1
answer
1k
views
Using Processing Framework in QGIS
I am writing a plugin for QGIS 2.0, and I want to use the processing framework to call some functions.
When I open the Python Console inside QGIS, I am able to call it like this:
>>> import ...
4
votes
0
answers
97
views
How to specify GDAL driver to use for Processing INPUT?
How can I specify a specific driver to be used by GDAL/OGR when running a tool via Processing? GDAL/OGR calls them prefixes to the connection string, e.g. https://gdal.org/drivers/vector/gmlas.html#...
4
votes
0
answers
253
views
Selecting and changing fields in QGIS graphical modeler
I am trying to run a model that makes a selection from a refactored and name changed field, and changes the value of the selection.
Refactoring is easy, as is making the selection within the renamed ...
4
votes
0
answers
545
views
Looking for definitive way to enable ALL QGIS module access in VS Code (Windows 10)
I'm having trouble importing and getting code inspection/autocompletion working for all the PyQGIS modules I need to do scripting in VS Code. After looking at these questions:
Understanding qgis....
4
votes
0
answers
330
views
Merging multiple layers in folder with Graphical Model Builder in QGIS 3.10
I am trying to create a graphical modeler that merges all the layers in a folder. I am using QGIS 3.10.12. I saw in some post that there used to be saga:mergeshapeslayer but its not included in the ...
4
votes
0
answers
245
views
Processing script returns no layer
I am trying to run a processing script without a user defined layer output. The example below should create a vector layer with one point. The script runs without any error but the layertree is empty. ...
4
votes
1
answer
319
views
Using memory layer as input with processing runalg in PyQGIS
My first processing runalg creates a memory layer as output.
I need to use this layer as the input for the second runalg.
#first
processing.run("qgis:fieldcalculator", {
'INPUT': '...
4
votes
1
answer
237
views
Adding layers to project from processing tool in QGIS 3
I'm trying to add some layers created during a process to a project.
There seems nothing to be added (TOC empty) but when I close QGIS it says:
This project includes one or more layers as temporary ...
4
votes
0
answers
347
views
QGIS 3 - Save processing output to memory and turn into numpy array?
I'm currently developing a python plugin for QGIS 3.
In short, the code conducts among others a viewshed algorithm, turns the output in a numpy array and calculates some spatial metrics the user can ...
4
votes
0
answers
484
views
Create lines to connect vertices in QGIS
I have a file that marks street edges and want to connect "crossing" points automatically. Image 1 shows the street edge, Image 2 shows the desired result. Is there a plugin or method I can use to ...
4
votes
0
answers
200
views
How to use Hub distance in a processing model?
I am trying to make line layer (hub distance layer ) between two point layer in QGIS 2.16.
It works fine when I make layers step by step but, I want to make MODEL in processing modeler and ...
4
votes
0
answers
1k
views
Where to find Advanced Python Field Calculator qgis syntax documentation
I am trying to follow some tutorials using Advanced Python field calculator, but when I enter the formula value = $geom.area() / < area> I get syntax error as in picture, while if I substitute ...
4
votes
0
answers
877
views
Error when using r.watershed in QGIS 2.10.1 with Grass
I am running r.watershed within QGIS processing the I get the error below.
I draw your attention to:
GRASS_INFO_WARNING(2205,1): Subprocess failed with exit code 256 GRASS_INFO_END(2205,1)
Does ...
4
votes
1
answer
624
views
What's the correct syntax for Execute SQL in Processing QGIS 2.6?
I made a small model with Processing in QGIS 2.6.
The final layer should be the result of a SQL query. Now, in the Execute SQL dialog window I can add the query:
select name, max(ele) as ele, geom
...
3
votes
0
answers
90
views
Gaussian in QGIS: SAGA vs Native Tool
I have been using SAGA Gaussian Filter to apply a filter to a raster layer, but for reasons I would like to use native QGIS tools if there is an equivalent.
There is a tool called Fuzzify raster (...
3
votes
0
answers
103
views
+50
Specifying compression for native raster Processing algorithms
I use QGIS' native native:fillnodata Processing tool to fill NODATA cells in a raster with a specific value. This works well but the resulting file is huge.
How can I specify raster compression for ...
3
votes
0
answers
224
views
Running Python script file exported from QGIS Graphical Modeller in external terminal
For instance, I have created a simple graphical modeler which gives NDVI as an output when the NIR band and Red Band are provided:
I exported the Python script using 'Export as script algorithm' in ...
3
votes
0
answers
97
views
Any advice on how to use r.stats in QGIS
I am trying to run r.stats in QGIS to get all unique combinations of data values from 2 raster layers. The process runs, outputs an HTML file, and does not throw any errors. However the files are ...
3
votes
0
answers
270
views
Error: Algorithm not found using grassprovider in PyQGIS standalone script
With QGIS 3.22 the GRASS algorithms got its own provider (grassprovider.Grass7AlgorithmProvider) and are no more part of processing.algs. Knowing this, in a standalone pyqgis-script I am trying to add ...
3
votes
0
answers
101
views
Disconnect processing.run() from source data in QGIS standalone OR How do I remove a file system object from OGR?
I am using processing.run("qgis:rastersampling") and need a way to disconnect the connection to the corresponding input vector file after each sampling operation. This is what I am thinking ...
3
votes
0
answers
138
views
QGIS: Values in the wrong columns after a refactor field
Currently I am still in the process of building a model with a refactor field algorithm. Even though I have perfectly set up how to convert my data into the right expression however the data's is ...
3
votes
0
answers
245
views
Getting a warning of "unexpected argument" for PyQGIS processing parameter in PyCharm
When specifying named argument for any type of QgsProcessingParameter, PyCharm complains of an Unexpected Argument warning. Although it doesn't cause any issue to the execution of the Processing ...
3
votes
0
answers
109
views
No Vector Menu Available QGIS 3.4
I've installed QGIS 3.4 on my Mac. I don't have any vector or processing menu. In the "plugins" menu under settings, I have the following:
"The settings on this tab are only applicable for Python ...
3
votes
0
answers
246
views
QGIS crashes when trying to return layer from processing toolbox console
The following script is intended to take a polygon layer and extract the features having a particular value ('natural') in a given field ('landuse') and return the selection.
Everything seems to work ...
3
votes
0
answers
128
views
Processing a Sqlite table in standalone QGIS application
I have been trying to use a single table of a Spatialite db in a standalone Python application. I have run it through the QGIS interface to find how it used the input pathway, which was: 'dbname=\'C:/...
3
votes
0
answers
1k
views
QGIS union (one vector layer): side location conflict?
I occurred an error when using "union" tool (only one layer) in QGIS. I have a series of vector files, yet only one vector file fails to union with the error information. The error is:
GEOS ...
3
votes
0
answers
612
views
Qgis 3.x: Python error when adding scripts to processing toolbox
When I add a script (any script) to QGIS 3.x I get the following Python error:
NameError: name 'Uitvoermap' is not defined
Traceback (most recent call last):
File "C:/PROGRA~1/QGIS3~1.4/apps/qgis/....
3
votes
0
answers
273
views
Line perpendicular to the maximum axis of an irregular polygon (sinkholes) QGIS 3
I am performing a morphometric analysis of dolines using QGIS 3. The analysis consists of determining the longest axis (the union of the two most distant points of the polygon) and the shortest axis ...
3
votes
0
answers
94
views
QGIS 3 processing script is recognized as a model
I refer to the QGIS 3 (QGIS 3.4.4-1, 64Bit standalone installer) processing script shown below. If I copy the script, do Create New Script... from the processing toolbox, paste it to the empty script ...
3
votes
0
answers
883
views
How do you view your Python scripts in the processing toolbox in QGIS 3?
I have been stuck on this for a while and I'm not sure if it is a bug or me doing something wrong but I cannot work out how to add Scripts to the processing toolbox in QGIS 3 series.
When I click the ...
3
votes
0
answers
631
views
QGIS 3.4 Processing Python Scripts folder default configuration is lost
I have lost the default configuration of the 'Processing Python Scripts folder' on QGIS 3.4 and in consecuence some Python processing scripts and plugins cannot work properly because they cannot find ...
3
votes
0
answers
578
views
Running an external QGIS Python Plugin with a Processing Script
I am working on a python script in the processing environment of QGIS 2.18. My goal is to run few tools one after another in an automated chain.
One of these tools is the external Plugin 'Join ...
3
votes
0
answers
5k
views
"Cannot find variable: staticmethod" message while running Processing script
Every time I run my own processing script in QGIS 2.18.22 I get this message fifteen times in Processing tab in Log Messages Panel :
1 Cannot find variable: staticmethod
1 Cannot find variable: ...