New answers tagged attribute-table
2
votes
Accepted
Summing length of lines of a specific category from another layer in QGIS
First solution: use overlay_intersects()
I recommend using overlay_intersects() function (available since QGIS 3.16). It is easier to handle when it involves (as here) spatial relationship (take into ...
5
votes
Creating hyperlink in the attribute table using QGIS
You need to do the following steps:
Add a new field with the name Link or any other name you like, a type of string, and put the length to equal 300 characters since you have long links.
Copy the ...
3
votes
Accepted
Creating hyperlink in the attribute table using QGIS
Create a text attribute field, insert the URL.
In Layer properties > Attributes Form tab, choose the field, set the Widget type to Text Edit and check the boxes Multiline and html.
Open the ...
1
vote
Copy/paste the JOIN settings in the layer properties from a layer to another like you do with styles using QGIS
The following PyQGIS code might solve this challenge for you:
# Set the original layer containing the join to be copied to other layers
sourceLayer = iface.activeLayer()
# The join properties to be ...
4
votes
Duplicating rows according to field values in QGIS
The SQLite way, for reference:
Unfortunately, SQLite neither supports arrays natively, nor their unnesting into sets of rows. The only, recommended yet slightly cumbersome way is a RECURSIVE CTE:
WITH ...
1
vote
Getting dictionary for each feature with their attribute values using PyQGIS
Another solution utilizes the attributeMap() method of the QgsFeature class.
Returns the feature's attributes as a map of field name to value.
from qgis.utils import iface
layer = iface.activeLayer(...
2
votes
Accepted
Duplicating rows according to field values in QGIS
Let's assume there is a polyline layer called 'lines' with three features in it, see the image below.
Step 1. Duplicate geometries as many times as needed by means of the "Array of translated ...
0
votes
Merging Attribute Table Field Values for Same File in QGIS
Be sure to only have the identical layers loaded in the QGIS project as this soultion is based on automatically looping through all layers in the project, using @layers variable (this returns a list ...
3
votes
Accepted
Converting column with category names to numeric codes in QGIS Field Calculator
If you have a long list of values and want to avoid adding each one manually, create an array of all unique values with concatenate_unique() and string_to_array(). For each field than check at which ...
4
votes
Converting column with category names to numeric codes in QGIS Field Calculator
Try the map() in combination with the map_get() and coalesce():
coalesce(map_get(map('Foo',1,'Bar',2,'Boo',3,'Far',4), "category"), 0)
3
votes
Exporting attribute table to CSV via pure Python in QGIS
I use this:
import csv
outFolder = r'/home/lissiklaus/Downloads/tmp/csv/'
filename = 'countries.csv'
outPath = f"{outFolder}{filename}"
layer = iface.activeLayer()
header = [field.name() ...
6
votes
Accepted
Exporting attribute table to CSV via pure Python in QGIS
You can use .getFeatures() to iterate over each feature
and .attributes() to fetch each feature's attributes:
layer = iface.activeLayer()
fieldnames = [field.name() for field in layer.fields()] #If ...
0
votes
Use previous entry as default in attribute table
I have the same problem in QField since one of the last updates i guess.
but only regarding check boxes
when i check a box the next added feature will automatically show the box as checked. Funny ...
4
votes
Accepted
Adding automatic numbering of the "id" field in QGIS
The first feature returns a NULL for maximum("id") as there are no id values to calculate a maximum on.
To get around this, use the coalesce() function which returns the first non-null value ...
0
votes
Accepted
QGIS form: relation value
Keep the "old" field with the old observers, then create a new field with value relation that you use for new oberservs: those you take with value relation from the table. So you have a ...
Top 50 recent answers are included
Related Tags
attribute-table × 2098qgis × 1099
arcgis-desktop × 458
fields-attributes × 278
field-calculator × 245
arcmap × 181
shapefile × 134
pyqgis × 120
attribute-joins × 109
arcpy × 106
qgis-3 × 89
python × 72
raster × 69
editing × 66
expression × 66
arcgis-10.2 × 61
arcgis-pro × 61
arcgis-10.1 × 56
select-by-attribute × 52
polygon × 49
arcgis-10.0 × 49
excel × 48
csv × 44
point × 43
export × 41