Skip to main content
67 votes

Identifying duplicate attributes in field using QGIS

Another graphical, dynamic and most importantly simple way to detect duplicate attributes: use QGIS's expression builder. Highlight duplicates in attribute table: Suppose FieldWithDuplicates is the ...
she_weeds's user avatar
  • 12.6k
56 votes

Understanding "Join Attributes by Location" in QGIS

Join Attributes by Location concatenates the following set of methods to compare geometries: intersects if the intersection of both geometries is not empty contains if the second geometry is ...
Taras's user avatar
  • 33.3k
47 votes

Change style properties of several layers simultaneously?

This works for QGIS 3.4 => Create a group of all the layers you want to have the same style Edit the style of one of the layers in the group to your liking Right-click the correctly styled layer; '...
GISinHelsinki's user avatar
41 votes
Accepted

Summing data from column in QGIS Attribute table

There are several approaches that I may suggest: Approach 1 : toolbar "Show statistical summary" tool from the Statistics panel (Ctrl+6). Symbolized as a Sigma symbol(), placed in the main ...
Taras's user avatar
  • 33.3k
32 votes

Renaming attributes/fields in shapefile attribute table using QGIS

Since QGIS 2.16 you no longer need a plugin to do this - you can double click a field name in a shapefile from the vector layer properties window and rename (set the layer as editable first)
ndawson's user avatar
  • 27.7k
29 votes
Accepted

Understanding "Join Attributes by Location" in QGIS

Don't think the QGIS docs has something as detailed as what is shown in the link in your comment (here is the link for English speakers). I would assume the terminology would be pretty much similar if ...
Joseph's user avatar
  • 76k
28 votes
Accepted

Getting field names of layer using PyQGIS

To get field names with fields() method or other field properties (length, type, comment, ...) you can use: field_names = [field.name() for field in layer.fields()] # ['id', 'attr1', 'attr2', 'attr3'] ...
Kadir Şahbaz's user avatar
27 votes
Accepted

Changing column order with Table Manager Plugin in QGIS 3

Yes, you can use the "Refactor fields" tool from the Toolbox:
RafDouglas C. Tommasi's user avatar
26 votes

Using IN-operator in query builder in QGIS

You could use something like: "Territory" IN ('India', 'China', 'Bhutan')
Joseph's user avatar
  • 76k
26 votes
Accepted

Adding text fields with more than 255 characters?

Shapefiles have a limitation of maximum 254 characters per field (See switchfromshapefile.org). If you need more than that you will need to switch to a different format. If you don't know which file ...
Matthias Kuhn's user avatar
22 votes
Accepted

Can colon (":") character be used in shapefile field names?

Field name restrictions inside a shapefile are determined by dBase limitations. There are four single rules: Up to 10 character max. First character in field name must start with a letter. Field ...
aldo_tapia's user avatar
  • 13.7k
20 votes
Accepted

Maximum value of field of vector layer using PyQGIS

It is not necessary to get a complete list of field values. In QgsVectorLayer exists 'maximumValue' method. So, this works well and it's shorter: layer = iface.activeLayer() idx = layer....
xunilk's user avatar
  • 30k
20 votes
Accepted

Converting string field into date field in QGIS

I'm surprised I haven't seen this before. Maybe I'm overlooking something obvious :) Although you're using a different locale to me, you're using the same date format as I do in the UK, dd/MM/yyyy. I ...
Steven Kay's user avatar
  • 20.5k
20 votes
Accepted

Filling shape with labels or attributes in QGIS?

On Layer Properties window, select Single Symbol | Fill | Simple fill - Symbol Layer Type- Point pattern fill | Font marker. Then click Data defined override (field) and choose your field.
Kazuhito's user avatar
  • 31k
19 votes

QGIS, Populate field with self-updating formula (like spreadsheet)

Yes, this functionality is called virtual fields. Open the field calculator and check the "virtual field" checkbox. The value will then be updated (or rather it is recalculated every time it is ...
Matthias Kuhn's user avatar
19 votes
Accepted

Creating predefined values in field using PyQGIS

You need to assign and configure a ValueMap widget to your layer's field in this way: QGIS 3.x fieldIndex = layer.fields().indexFromName( 'myField' ) editor_widget_setup = QgsEditorWidgetSetup( '...
Germán Carrillo's user avatar
19 votes
Accepted

AttributeError: 'QgsVectorLayer' object has no attribute 'fieldNameIndex'

In PyQGIS 3 Use one of the following methods from the QgsFields class: indexFromName() layer = iface.activeLayer() layer_fields = layer.fields() field_index = layer_fields.indexFromName("...
user122730's user avatar
18 votes
Accepted

Updating text column of selected features in QGIS

make sure the layer is in edit mode (otherwise changes will not happen) Select features to change (however you like) then open attribute table select the attribute to change type in what you want it ...
Ian Turton's user avatar
  • 82.2k
18 votes

Changing fields order in QGIS

Open the attribute table. Right-click the column headings in the attribute table. Select "Organize columns" in the drop-down menu. Then, just drag the heading to the position you want it to ...
Angela P's user avatar
  • 361
18 votes
Accepted

Copying & pasting multiple values from one feature to other features in the same layer in QGIS

There is the AttributePainter plugin (https://plugins.qgis.org/plugins/attributePainter/) for this. Usage: Click on Pick source feature and select a sample feature on the map. On the table, a ...
Kadir Şahbaz's user avatar
16 votes

Getting list of distinct values from shapefile field using QGIS

QGIS now has a tool that will list unique values in one or more fields in a layer. "This algorithm generates a report with information about the unique values found in a given attribute (or attributes)...
David Bartecchi's user avatar
16 votes
Accepted

Adding Properties to a feature in Google Earth Engine

Yes, you can use the feature.set()option which Feature Overview covers with these examples: // Make a feature and set some properties. var feature = ee.Feature(ee.Geometry.Point([-122.22599, 37.17605]...
whyzar's user avatar
  • 12.1k
16 votes
Accepted

Getting dictionary for each feature with their attribute values using PyQGIS

The QgsJsonUtils class has exportAttributes method for getting attributes as a dict. Solution 1: Making a dictionary including feature "id" as key, attributes map as value: {feature1.id: {...
Kadir Şahbaz's user avatar
15 votes

Sorting by multiple fields at same time in QGIS?

This can now be done without any plugins or database-specific work, at least for version 3.2+. To sort by multiple columns: Right click on the attribute table column header and choose "Sort..." Add ...
Eron Lloyd's user avatar
15 votes

How to split text attribute by characters in QGIS?

You can use the Field calculator with the following expression: string_to_array("Nombre", ' ') The string_to_array() function splits string into an array using supplied delimiter. If you want a ...
Jhon Galindo's user avatar
15 votes
Accepted

KeyError: '-1' when adding field and calculating expression with PyQGIS

The error you get says the field index is -1, so your new field wasn't found in your attribute table. That may be happening because: You need to use QVariant.Double instead of QVariant.Float. You've ...
Germán Carrillo's user avatar
15 votes
Accepted

Changing fields order in QGIS

Open the Fields tab from the Layer properties. From there, select the Drag and drop designer option and drag to the right the fields you want to edit. You can also change the field order. You can then ...
JGH's user avatar
  • 42.3k
15 votes

Getting field names of layer using PyQGIS

List field names with dataProvider() method from qgis.utils import iface # get active layer if not already set layer = iface.activeLayer() prov = layer.dataProvider() field_names = [field.name() ...
grego's user avatar
  • 1,063
14 votes
Accepted

Getting ArcGIS to include leading zeros in text field

Python has a built-in for leading zeros. Use str.zfill() to add leading zeros into a text field. my_string = "1" print my_string.zfill(2) # Prints 01 my_string = "1000" print my_string.zfill(2) ...
Midavalo's user avatar
  • 29.8k
14 votes

ESRI Field Names?

Your field names seem to be linked to CENSUS data (very similar to this file ) @Map_man answer will lead you to the source of your data, to be sure. See here some metadata that seem to fit : https://...
gisnside's user avatar
  • 7,858

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