5
votes
Accepted
Getting Python code that QGIS analysis tools are running in background
Go to Processing Toolbox, click the History button, then right-click each entry you want and select "Copy as Python Command"
3
votes
Changing appearence of DateTime input in QGIS Processing tool to international datetime format
You could write your own widget. The following example (DateTimeWidget) is derived from this tutorial. But first some imports:
from qgis.PyQt.QtCore import (
QCoreApplication,
QDateTime,
)
...
2
votes
Deleting all fields from attribute table in QGIS processing script
Try this:
def deletecolumn(layer, output):
#Drop all fields of the layer
dropfields = [field.name() for field in layer.fields()] # iterate over the layer's fields and store the fieldnames in ...
2
votes
Accepted
Keeping track of features when adding them to new layer using PyQGIS
Both of your equality tests will return False because you are simply comparing two different geometry objects and two different feature objects.
To test for identical geometries, you can use the ...
2
votes
Getting Python code that QGIS analysis tools are running in background
from a linear set of actions
This statement here suggests to me you are looking for something along the lines of the Model Designer, which you can then export out to Python.
You can build a linear ...
1
vote
Loading multiple layers into QGIS Batch processing
There are different options. Use the one that fits your needs:
Add values by expression
Use Autofill... > Add values by expression and define an expression that generates an array of strings that ...
1
vote
Deleting all fields from attribute table in QGIS processing script
Another option is to use the attributeList() and deleteAttributes() methods from the QgsVectorLayer class:
layer = QgsProject.instance().mapLayersByName('grid_test')[0]
columns_to_delete_indx = layer....
1
vote
Extracting bulding heights from height map into attribute table
The Zonal Statistics plugin (Processing) did the job. I first took the height of the surface scan and, then applied the plugin again to the tempary layer created and then apple the plugin to the ...
1
vote
Return generated geometry using a QGIS aggregate function
You can put the geometry in a field, but it will be more complex. I suggest you to create two fields: x_centroid and y_centroid.
Try this:
To calculate x:
x(aggregate(
layer:= 'adm3_polys',
...
1
vote
How does "is_child_algorithm=True" work in processing.run in Python QGIS script?
According to QGIS source code the is_child_algorithm parameter is used to indicate "if this algorithm is being run as part of a larger algorithm" (for example if a given algorithm is part of ...
1
vote
Layer style fails to set for temporary layers derived from same layer using PyQGIS
There is a space in my code which caused the path to the style file to be invalid.
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
qgis-processing × 1480qgis × 913
pyqgis × 559
qgis-3 × 291
qgis-plugins × 175
python × 117
grass × 99
qgis-modeler × 93
saga × 76
pyqgis-3 × 74
qgis-2 × 68
raster × 48
gdal × 31
r × 29
standalone × 24
batch × 23
vector × 20
raster-calculator × 20
error × 20
ubuntu × 20
algorithm × 20
buffer × 19
postgis × 18
polygon × 18
field-calculator × 18