8 votes
Accepted

Excluding zero values in proportion calculation in QGIS

Use this expression: array_mean( array_remove_all( array("field1", "field2", ...), 0 ) )
user avatar
  • 811
7 votes

Getting list of values from column in QGIS

Use the Field Calculator with this expression: array_to_string( array_distinct( array_agg(expression:="column D") ) ) This expression utilizes the following ...
user avatar
  • 24k
6 votes
Accepted

Summing numbers separated by commas in string field in QGIS

You can use arrays in fieldcalculator for this: array_sum(array_foreach(string_to_array("lengths",','),to_real(@element))) Turn the string into an array Iterate over the array and convert ...
user avatar
  • 25.5k
6 votes

Changing field length in QGIS

If you want to change the length of a field you need to use the “Refactor fields” tool.
user avatar
  • 811
5 votes

Getting list of values from column in QGIS

You can create a virtual layer to fetch the distinct values Go to the menu Layer > Add Layer > Add/Edit Virtual Layer... and enter the query: SELECT DISTINCT "column D" FROM myLayer; ...
user avatar
  • 34.6k
5 votes

Creating new attribute field gained by areal intersection in QGIS

Try this: if(overlay_within('polygon_D_e5a424dd_6e6f_447e_952a_44b4f0dd6f9a'), 1, 2) It utilizes the overlay_within() and if() functions.
user avatar
  • 24k
5 votes

Changing field length in QGIS

As in the comment from Binx, the main bit here is to calculate a new field and use the input boxes to set the field type and length: Using 'length()' in the expression will return the actual number ...
user avatar
  • 1,349
4 votes

Making rule on dates for vector points in QGIS

We are starting from a common issue here: your date is not a date. It is a string representing a date. And strings cannot be compared by smaller than, less than or similar operators. Another issue is ...
user avatar
  • 25.5k
4 votes
Accepted

Creating rule-based style for attribute between two values in QGIS

Try rewriting your rules like this: "NumberOfFloors" >=1 AND "NumberOfFloors" <= 3 "NumberOfFloors" >=4 AND "NumberOfFloors" <= 6 ... "...
user avatar
  • 21.3k
3 votes

Finding duplicates in field depending on another field's values using PyQGIS

I like collections.defaultdict(list): from collections import defaultdict layer = QgsProject.instance().mapLayersByName('ok_ak_riks')[0] fieldnames = ['kom_kod', 'lan_kod'] d = defaultdict(list) for f ...
user avatar
  • 52.1k
2 votes

Navigating attributes tables with arrows keys in QGIS

Toggle editing mode: if you are in no-editing mode, you can navigate with arrow up/down without changing the content of the cell. If you want to stay in edit mode, press ENTER then arrow down, ENTER - ...
user avatar
  • 40.9k
2 votes
Accepted

Sorting values in Unique Values widget in QGIS

Instead of using the Unique Values widget type, a workaround is to use the Value Map widget type and select the option to Load Data From Layer. Then, using your kestrel_box_inspections layer, select ...
user avatar
  • 14.3k
2 votes

Finding duplicates in field depending on another field's values using PyQGIS

Try this: layer = iface.activeLayer() field_a = 'Field1' # set inside quotes the name of Field1 field_b = 'Field2' # set inside quotes the name of Field2 feat_list = [(feature.attribute(field_a), ...
user avatar
  • 811
1 vote

Relationship by location in QGIS

You can use this expression: array_to_string ( overlay_within ( 'Polygons_layer', Attribute_Polygon_you_want ) )` This is for "completly within", but there are other &...
user avatar
  • 680
1 vote

Finding features in QGIS with partly different attributes

I would merge the layers first, then with field calculator I would create a a virtual field "uuid"||'_'||"name" then using this solution to find duplicates: Identifying duplicate ...
user avatar
  • 1,420
1 vote

Navigating attributes tables with arrows keys in QGIS

You could change the widget type from "Range" to "Text edit" in layer's Properties -> Attributes Form. You should modify the form type from "Autogenerate" to "...
user avatar

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