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"
user avatar
  • 52.7k
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, ) ...
user avatar
  • 1,316
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 ...
user avatar
  • 25.6k
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 ...
user avatar
  • 14.4k
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 ...
user avatar
  • 2,744
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 ...
user avatar
  • 41k
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....
user avatar
  • 24k
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 ...
user avatar
  • 121
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', ...
user avatar
  • 955
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 ...
user avatar
  • 823
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.
user avatar
  • 166

Only top scored, non community-wiki answers of a minimum length are eligible