Übersetzen ist eine Gemeinschaftsleistung - Sie können mitmachen <https://qgis.org/en/site/getinvolved/translate.html#becoming-a-translator>`_. Diese Seite ist aktuell zu 29.11% übersetzt.

16.2. Mit Attributtabelle arbeiten

The attribute table displays information on features of a selected layer. Each row in the table represents a feature (with or without geometry), and each column contains a particular piece of information about the feature. Features in the table can be searched, selected, moved or even edited.

16.2.1. Foreword: Spatial and non-spatial tables

QGIS allows you to load spatial and non-spatial layers. This currently includes tables supported by GDAL and delimited text, as well as the PostgreSQL, MS SQL Server, SpatiaLite and Oracle providers. All loaded layers are listed in the Layers panel. Whether a layer is spatially enabled or not determines whether you can interact with it on the map.

Non-spatial tables can be browsed and edited using the attribute table view. Furthermore, they can be used for field lookups. For example, you can use columns of a non-spatial table to define attribute values, or a range of values that are allowed, to be added to a specific vector layer during digitizing. Have a closer look at the edit widget in section Eigenschaften Attributformular to find out more.

16.2.2. Introducing the attribute table interface

To open the attribute table for a vector layer, activate the layer by clicking on it in the Layer-Bedienfeld. Then, from the main Layer menu, choose openTable Open Attribute Table. It is also possible to right-click on the layer and choose openTable Open Attribute Table from the drop-down menu, or to click on the openTable Open Attribute Table button in the Attributes toolbar. If you prefer shortcuts, F6 will open the attribute table. Shift+F6 will open the attribute table filtered to selected features and Ctrl+F6 will open the attribute table filtered to visible features.

This will open a new window that displays the feature attributes for the layer (figure_attributes_table). According to the setting in Settings ► Options ► Data sources menu, the attribute table will open in a docked window or a regular window. The total number of features in the layer and the number of currently selected/filtered features are shown in the attribute table title, as well as if the layer is spatially limited.


Abb. 16.68 Attributtabelle des regions Layer

Die anderen Knöpfe im Kopf der Attributtabelle stellen die folgenden Funktionalitäten zur Verfügung:

Tab. 16.1 Available Tools




Default Shortcut


Toggle editing mode

Enable editing functionalities



Toggle multi edit mode

Update multiple fields of many features


Save Edits

Save current modifications


Reload the table


Add feature

Add new geometryless feature


Delete selected features

Remove selected features from the layer


Cut selected features to clipboard



Copy selected features to clipboard



Paste features from clipboard

Insert new features from copied ones



Select features using an Expression


Select All

Select all features in the layer



Invert selection

Invert the current selection in the layer



Deselect all

Deselect all features in the current layer



Filter/Select features using form



Move selected to top

Move selected rows to the top of the table


Pan map to the selected rows



Zoom map to the selected rows



New field

Add a new field to the data source



Delete field

Remove a field from the data source


Organize columns

Show/hide fields from the attribute table


Open field calculator

Update field for many features in a row



Conditional formatting

Enable table formatting


Dock attribute table

Allows to dock/undock the attribute table



Lists the actions related to the layer


Depending on the format of the data and the GDAL library built with your QGIS version, some tools may not be available.

Below these buttons is the Quick Field Calculation bar (enabled only in edit mode), which allows to quickly apply calculations to all or part of the features in the layer. This bar uses the same expressions as the calculateField Field Calculator (see Editiere Attributwerte). Table view vs Form view

QGIS provides two view modes to easily manipulate data in the attribute table:

  • The openTable Table view, displays values of multiple features in a tabular mode, each row representing a feature and each column a field. A right-click on the column header allows you to configure the table display while a right-click on a cell provides interaction with the feature.

    The attribute table supports Shift+Mouse Wheel scrolling in table view mode to switch between vertical and horizontal scrolling movements. This can also be achieved replacing the mouse with the trackpad on macOS.

  • The formView Form view shows feature identifiers in a first panel and displays only the attributes of the clicked identifier in the second one. There is a pull-down menu at the top of the first panel where the „identifier“ can be specified using an attribute (Column preview) or an Expression. The pull-down also includes the last 10 expressions for re-use. Form view uses the layer fields configuration (see Eigenschaften Attributformular).

    You can browse through the feature identifiers with the arrows on the bottom of the first panel. The features attributes update in the second panel as you go. It’s also possible to identify or move to the active feature in the map canvas with pushing down any of the button at the bottom:

    • highlightFeature Highlight current feature if visible in the map canvas

    • panTo Automatically pan to current feature

    • zoomTo Zoom to current feature

You can switch from one mode to the other by clicking the corresponding icon at the bottom right of the dialog.

You can also specify the Default view mode at the opening of the attribute table in Settings ► Options ► Data Sources menu. It can be ‚Remember last view‘, ‚Table view‘ or ‚Form view‘.


Abb. 16.69 Attribute table in table view (top) vs form view (bottom) Configuring the columns

Right-click in a column header when in table view to have access to tools that help you control:

Resizing columns widths

Columns width can be set through a right-click on the column header and select either:

  • Set width… to enter the desired value. By default, the current value is displayed in the widget

  • Set all column widths… to the same value

  • Autosize to resize at the best fit the column.

  • Autosize all columns

A column size can also be changed by dragging the boundary on the right of its heading. The new size of the column is maintained for the layer, and restored at the next opening of the attribute table.

Hiding and organizing columns and enabling actions

By right-clicking in a column header, you can choose to Hide column from the attribute table (in „table view“ mode). For more advanced controls, press the editTable Organize columns… button from the dialog toolbar or choose Organize columns… in a column header contextual menu. In the new dialog, you can:

  • check/uncheck columns you want to show or hide: a hidden column will disappear from every instances of the attribute table dialog until it is actively restored.

  • drag-and-drop items to reorder the columns in the attribute table. Note that this change is for the table rendering and does not alter the fields order in the layer datasource

  • add a new virtual Actions column that displays in each row a drop-down box or a button list of enabled actions. See Eigenschaften Aktionen for more information about actions.

Sorting rows

The rows can be sorted by any column, by clicking on the column header. A small arrow indicates the sort order (downward pointing means descending values from the top row down, upward pointing means ascending values from the top row down). You can also choose to sort the rows with the Sort… option of the column header context menu and write an expression. E.g. to sort the rows using multiple columns you can write concat(col0, col1).

In form view, features identifier can be sorted using the sort Sort by preview expression option.

Note that sorting the rows only affects the table rendering and does not alter the features order in the layer datasource.


Sorting based on columns of different types

Trying to sort an attribute table based on columns of string and numeric types may lead to unexpected result because of the concat("USE", "ID") expression returning string values (ie, 'Borough105' < 'Borough6'). You can workaround this by using eg concat("USE", lpad("ID", 3, 0)) which returns 'Borough105' > 'Borough006'. Formatting of table cells using conditions

Conditional formatting settings can be used to highlight in the attribute table features you may want to put a particular focus on, using custom conditions on feature’s:

  • geometry (e.g., identifying multi-parts features, small area ones or in a defined map extent…);

  • or field value (e.g., comparing values to a threshold, identifying empty cells, duplicates, …).

You can enable the conditional formatting panel clicking on conditionalFormatting Conditional formatting button at the top right of the attributes window in table view (not triggered in form view).

The new panel allows user to add new rules to format rendering of radioButtonOnField or radioButtonOffFull row. Adding new rule opens a form to define:

  • the name of the rule;

  • a condition using any of the expression builder functions;

  • the formatting: it can be choosen from a list of predefined formats or created based on properties like:

    • background and text colors;

    • use of icon;

    • bold, italic, underline, or strikeout;

    • Schriftart.


Abb. 16.70 Bedingte Formatierungsregeln für Attributtabellen

16.2.3. Interacting with features in an attribute table Objekte auswählen

In table view, each row in the attribute table displays the attributes of a unique feature in the layer. Selecting a row selects the feature and likewise, selecting a feature in the map canvas (in case of geometry enabled layer) selects the row in the attribute table. If the set of features selected in the map canvas (or attribute table) is changed, then the selection is also updated in the attribute table (or map canvas) accordingly.

Zeilen können ausgewählt werden, indem Sie auf die Zeilennummer links neben der Zeile klicken. Mehrere Zeilen können ausgewählt werden, indem die Strg Taste während der Auswahl gedrückt wird.Eine kontinuierliche Auswahl ist möglich, indem Sie bei der Selektion die Umschalt Taste gedrückt halten, während Sie die Zeilennummern auswählen. Alle Zeilen zwischen der aktuell ausgewählten Zeile und der Mauspfeilposition werden dadurch selektiert. Bewegt man den Mauszeiger in der Attributtabelle indem man in eine Zelle in der Tabelle klickt ändert die Zeilenauswahl nicht. Verändert man die Auswahl im Kartenfenster bewegt sich der Mauszeiger in der Attributtabelle nicht.

In form view of the attribute table, features are by default identified in the left panel by the value of their displayed field (see Eigenschaften Anzeige). This identifier can be replaced using the drop-down list at the top of the panel, either by selecting an existing field or using a custom expression. You can also choose to sort the list of features from the drop-down menu.

Click a value in the left panel to display the feature’s attributes in the right one. To select a feature, you need to click inside the square symbol at the left of the identifier. By default, the symbol turns into yellow. Like in the table view, you can perform multiple feature selection using the keyboard combinations previously exposed.

Beyond selecting features with the mouse, you can perform automatic selection based on feature’s attribute using tools available in the attribute table toolbar, such as (see section Automatische Auswahl von Objekten and subsequent for more information and use case):

  • expressionSelect Select By Expression…

  • formSelect Select Features By Value…

  • deselectActiveLayer Deselect All Features from the Layer

  • selectAll Select All Features

  • invertSelection Invert Feature Selection.

It is also possible to select features using forms. Filtering features

Once you have selected features in the attribute table, you may want to display only these records in the table. This can be easily done using the Show Selected Features item from the drop-down list at the bottom left of the attribute table dialog. This list offers the following filters:

  • openTable Show All Features

  • openTableSelected Show Selected Features - same as using Open Attribute Table (Selected Features) from the Layer menu or the Attributes Toolbar or pressing Shift+F6

  • openTableVisible Show Features visible on map - same as using Open Attribute Table (Visible Features) from the Layer menu or the Attributes Toolbar or pressing Ctrl+F6

  • openTableInvalid Show Features with Failing Constraints - features will be filtered to only show the ones which have failing constraints. Depending on whether the unmet constraint is hard or soft, failing field values are displayed in respectively dark or light orange cells.

  • openTableEdited Show Edited and New Features - same as using Open Attribute Table (Edited and New Features) from the Layer menu or the Attributes Toolbar

  • Field Filter - allows the user to filter based on value of a field: choose a column from a list, type or select a value and press Enter to filter. Then, only the features matching num_field = value or string_field ilike '%value%' expression are shown in the attribute table. You can check checkbox Case sensitive to be less permissive with strings.

  • filterMap Advanced filter (Expression) - Opens the expression builder dialog. Within it, you can create complex expressions to match table rows. For example, you can filter the table using more than one field. When applied, the filter expression will show up at the bottom of the form.

  • handleStoreFilterExpressionChecked Stored filter expressions ►: a shortcut to saved expressions frequently used for filtering your attribute table.

It is also possible to filter features using forms.


Filtering records out of the attribute table does not filter features out of the layer; they are simply momentaneously hidden from the table and can be accessed from the map canvas or by removing the filter. For filters that do hide features from the layer, use the Query Builder.


Update datasource filtering with Show Features Visible on Map

When for performance reasons, features shown in attribute table are spatially limited to the canvas extent at its opening (see Data Source Options for a how-to), selecting Show Features Visible on Map on a new canvas extent updates the spatial restriction. Storing filter expressions

Expressions you use for attribute table filtering can be saved for further calls. When using Field Filter or Advanced Filter (expression) entries, the expression used is displayed in a text widget in the bottom of the attribute table dialog. Press the handleStoreFilterExpressionUnchecked Save expression with text as name next to the box to save the expression in the project. Pressing the drop-down menu next to the button allows to save the expression with a custom name (Save expression as…). Once a saved expression is displayed, the handleStoreFilterExpressionChecked button is triggered and its drop-down menu allows you to Edit the expression and name if any, or Delete stored expression.

Saved filter expressions are saved in the project and available through the Stored filter expressions menu of the attribute table. They are different from the user expressions, shared by all projects of the active user profile. Filtering and selecting features using forms

Clicking the filterMap Filter/Select features using form or pressing Ctrl+F will make the attribute table dialog switch to form view and replace each widget with its search variant.

From this point onwards, this tool functionality is similar to the one described in Objekte nach Wert auswählen, where you can find descriptions of all operators and selecting modes.


Abb. 16.71 Attribute table filtered by the filter form

When selecting / filtering features from the attribute table, there is a Filter features button that allows defining and refining filters. Its use triggers the Advanced filter (Expression) option and displays the corresponding filter expression in an editable text widget at the bottom of the form.

If there are already filtered features, you can refine the filter using the drop-down list next to the Filter features button. The options are:

  • Filter within („AND“)

  • Extend filter („OR“)

To clear the filter, either select the Show all features option from the bottom left pull-down menu, or clear the expression and click Apply or press Enter. More actions on features

Users have several possibilities to manipulate feature in an attribute table. Right-click in a cell and you can:

  • Select all (Ctrl+A) the features;

  • Copy the content of a cell in the clipboard with Copy cell content;

  • Zoom to feature without having to select it beforehand;

  • Pan to feature without having to select it beforehand;

  • Flash feature, to highlight it in the map canvas;

  • Open form: it toggles attribute table into form view with a focus on the clicked feature.

  • Display a list of actions, previously enabled in the Layer properties ► Actions tab.


Abb. 16.72 Copy cell content button

If you want to use attribute data in external programs (such as Excel, LibreOffice, or a custom web application), select one or more row(s) and use the copySelected Copy selected rows to clipboard button or press Ctrl+C.

In Settings ► Options ► Data Sources menu you can define the format to paste to with Copy features as dropdown list:

  • Plain text, no geometry: attributes are copied as text but the geometry is skipped

  • Plain text, WKT geometry: attributes are copied as text and the geometry is returned in WKT

  • GeoJSON: attributes and geometry are formatted as GeoJSON data

16.2.4. Editiere Attributwerte

In order to modify data in an attribute table, you should first toggle the layer into edit. Press the toggleEditing Toggle Editing button. Depending on the layer geometry type and the clipboard state, a few more tools are enabled in the attribute table top toolbar.

Editing attribute values can then be done by:

  • typing the new value directly in the cell, whether the attribute table is in table or form view. Changes are hence done cell by cell, feature by feature;

  • using the field calculator: update in a row a field that may already exist or to be created but for multiple features. It can be used to create virtual fields;

  • using the quick field calculation bar: same as above but for only existing field;

  • or using the multi edit mode: update in a row multiple fields for multiple features.

Putting the layer into edit mode will also allow you to editPaste Paste features from clipboard (Ctrl+V) editCut Cut selected rows to clipboard (Ctrl+X) or deleteSelectedFeatures Delete selected features. More details at Editierfunktionen. Using the Field Calculator

The calculateField Field Calculator button in the attribute table allows you to perform calculations on the basis of existing attribute values or defined functions, for instance, to calculate length or area of geometry features. The results can be used to update an existing field, or written to a new field (that can be a virtual one).

The field calculator is available on any layer that supports edit. When you click on the field calculator icon the dialog opens (see Abb. 16.73). If the layer is not in edit mode, a warning is displayed and using the field calculator will cause the layer to be put in edit mode before the calculation is made.

Based on the Expression Builder dialog, the field calculator dialog offers a complete interface to define an expression and apply it to an existing or a newly created field. To use the field calculator dialog, you must select whether you want to:

  1. apply calculation on the whole layer or on selected features only

  2. create a new field for the calculation or update an existing one.


Abb. 16.73 Feldrechner

If you choose to add a new field, you need to enter a field name, a field type (integer, real, date or string) and if needed, the total field length and the field precision. For example, if you choose a field length of 10 and a field precision of 3, it means you have 7 digits before the dot, and 3 digits for the decimal part.

Ein kurzes Beispiel zeigt wie der Feldrechner arbeitet, wenn Sie den Reiter Ausdruck verwenden. Wir wollen die Länge des ‚railroads‘ Layers aus dem QGIS Beispieldatensatz in km berechnen:

  1. Laden Sie das Shape railroads.shp in QGIS und öffnen Sie die den Dialog openTable Attributtabelle öffnen.

  2. Klicken Sie auf toggleEditing Bearbeitungsmodus umschalten und öffnen Sie den calculateField Feldrechner Dialog.

  3. Wählen Sie das checkbox Neues Feld anlegen Kontrollkästchen um die Berechnungen in ein neues Feld zu speichern.

  4. Set Output field name to length_km

  5. Select Decimal number (real) as Output field type

  6. Set the Output field length to 10 and the Precision to 3

  7. Double click on $length in the Geometry group to add the length of the geometry into the Field calculator expression box (you will begin to see a preview of the output, up to 60 characters, below the expression box updating in real-time as the expression is assembled).

  8. Complete the expression by typing / 1000 in the Field calculator expression box and click OK.

  9. You can now find a new length_km field in the attribute table. Creating a Virtual Field

A virtual field is a field based on an expression calculated on the fly, meaning that its value is automatically updated as soon as an underlying parameter changes. The expression applies to all the features in the layer and is set once; you no longer need to recalculate the field each time underlying values change. For example, you may want to use a virtual field if you need area to be evaluated as you digitize features or to automatically calculate a duration between dates that may change (e.g., using now() function).

Creating a virtual field is done through the calculateField Field calculator dialog and follows the same procedure as for regular fields. Simply remember to check the checkbox Create virtual field option and use a field type compatible with the data your expression would generate.

Editing a virtual field is done through the Felder Fields tab of the layer properties dialog (see Eigenschaften Felder). The expression defining the field is exposed in the Comment column, and pressing the expression button next to it opens an expression editor window for update.


Virtuelle Felder benutzen

  • A field can be set virtual only at its creation.

  • Virtuelle Felder sind nicht dauerhaft in den Layerattributen, was bedeutet, dass sie in der Projektdatei gespeichert und verfügabr sind, in der sie gespeichert wurden. Using the Quick Field Calculation Bar

While Field calculator is always available, the quick field calculation bar on top of the attribute table is only visible if the layer is in edit mode. Thanks to the expression engine, it offers a quicker access to edit an already existing field:

  1. Select the field to update in the drop-down list.

  2. Fill the textbox with a value, an expression you directly write or build using the expression expression button.

  3. Click on Update All, Update Selected or Update Filtered button according to your need.


Abb. 16.74 Quick Field Calculation Bar Editing multiple fields

Unlike the previous tools, multi edit mode allows multiple attributes of different features to be edited simultaneously. When the layer is toggled to edit, multi edit capabilities are accessible:

  • using the multiEdit Toggle multi edit mode button from the toolbar inside the attribute table dialog;

  • or selecting Edit ► multiEdit Modify attributes of selected features menu.


Unlike the tool from the attribute table, hitting the Edit ► Modify Attributes of Selected Features option provides you with a modal dialog to fill attributes changes. Hence, features selection is required before execution.

In order to edit multiple fields in a row:

  1. Select the features you want to edit.

  2. From the attribute table toolbar, click the multiEdit button. This will toggle the dialog to its form view. Feature selection could also be made at this step.

  3. At the right side of the attribute table, fields (and values) of selected features are shown. New widgets appear next to each field allowing for display of the current multi edit state:

    • multiEditMixedValues The field contains different values for selected features. It’s shown empty and each feature will keep its original value. You can reset the value of the field from the drop-down list of the widget.

    • multiEditSameValues All selected features have the same value for this field and the value displayed in the form will be kept.

    • multiEditChangedValues The field has been edited and the entered value will be applied to all the selected features. A message appears at the top of the dialog, inviting you to either apply or reset your modification.

    Clicking any of these widgets allows you to either set the current value for the field or reset to original value, meaning that you can roll back changes on a field-by-field basis.


    Abb. 16.75 Editing fields of multiple features

  4. Make the changes to the fields you want.

  5. Click on Apply changes in the upper message text or any other feature in the left panel.

Changes will apply to all selected features. If no feature is selected, the whole table is updated with your changes. Modifications are made as a single edit command. So pressing undo Undo will rollback the attribute changes for all selected features at once.


Multi edit mode is only available for auto generated and drag and drop forms (see Customizing a form for your data); it is not supported by custom ui forms.

16.2.5. Exploring features attributes through the Identify Tool

The identify Identify features tool can be used to display all attributes of a feature in the map canvas. It is a quick way to view and verify all data without having to search for it in the attribute table.

To use the Identify features tool for vector layers, follow these steps:

  1. Select the vector layer in the Layers panel.

  2. Click on the Identify features tool in the toolbar or press Ctrl+Shift+I.

  3. Click on a feature in the map view.

The Identify results panel will display different features information depending on the layer type. There are two columns in the panel, on the left side you can see Feature and on the right side Value. Under the Feature column, panel will display following information:

  • Derived section - those are the information calculated or derived from other information in the layer. For example, the area of a polygon or the length of a line. General information that can be found in this section:

    • Depending on the geometry type, cartesian measurements of length, perimeter, or area in the layer’s CRS units. For 3D line vectors, the cartesian line length is available.

    • Depending on the geometry type and if an ellipsoid is set in the Project Properties dialog (General ► Measurements), ellipsoidal values of length, perimeter, or area using the specified units.

    • The count of geometry parts in the feature and the number of the part clicked.

    • The count of vertices in the feature.

    Coordinate information that can be found in this section:

    • X and Y coordinate values of the clicked point.

    • The number of the closest vertex to the clicked point.

    • X and Y coordinate values of the closest vertex.

    • If you click on a curved segment, the radius of that section is also displayed.

  • Datenattribute: Dies ist die Liste von Attributfeldern und Werten für das Objekt, welches angeklickt wurde.

  • Informationen über das zugehörige untergeordnete Objekt, wenn Sie eine Beziehung definiert haben

    • der Name der Beziehung

    • den Eintrag im Referenzfeld, z. B. den Namen des zugehörigen untergeordneten Objekts

    • Aktionen: listet die im Eigenschaftsdialog des Layers definierten Aktionen auf (siehe Eigenschaften Aktionen) die Standardaktion ist Objektformular anzeigen.

    • Objektattribute: Dies ist die Liste der Attributfelder und Werte des zugehörigen untergeordneten Objekts.

16.2.6. Storing and fetching an external resource

A field may target a resource stored on an external storage system. Attribute forms can be configured so they act as a client to an external storage system in order to store and fetch those resources, on users demand, directly from the forms. Configuring an external storage

In order to setup an external storage, you have to first configure it from the vector attribute form properties and select the Attachment widget.


Abb. 16.76 Editing a WebDAV external storage for a given field

From the Attachment widget, you have to first select the Storage type:

  • Select Existing File: The target URL already exists. When you select a resource, no store operation is achieved, the attribute is simply updated with the URL.

  • Simple Copy: Stores a copy of the resource on a file disk destination (which could be a local or network shared file system) and the attribute is updated with the path to the copy.

  • WebDAV Storage: The resource is pushed to a HTTP server supporting the WebDAV protocol and the attribute is updated with its URL. Nextcloud, Pydio or other file hosting software support this protocol.

  • AWS S3: The resource is pushed to a server supporting AWS Simple Storage Service protocol and the attribute is updated with its URL. Amazon Web Service and MinIO hosting software support this protocol.

Then, you have to set up the Store URL parameter, which provides the URL to be used when a new resource needs to be stored. It’s possible to set up an expression using the data defined override widget in order to have specific values according to feature attributes.

The variable @selected_file_path could be used in that expression and represent the absolute file path of the user selected file (using the file selector or drag’n drop).


Using the WebDAV or AWS S3 external storage, if the URL ends with a „/“, it is considered as a folder and the selected file name will be appended to get the final URL.

If the external storage system needs to, it’s possible to configure an authentication.


To use the AWS S3 external storage, you must use an AWS S3 authentication type. Using an external storage

Once configured, you can select a local file using the button when editing a feature’s attribute. Depending on the configured storage type, the file will be stored on the external storage system (except if Select existing file has been selected) and the field will be updated with the new resource URL.


Abb. 16.77 Storing a file to a WebDAV external storage


User can also achieve the same result if he drags and drops a file on the whole attachment widget.

Use the taskCancel Cancel button to abort the storing process. It’s possible to configure a viewer using the Integrated document viewer so the resource will be automatically fetched from the external storage system and displayed directly below the URL. The above warning icon indicates that the resource cannot be fetched from the external storage system. In that case, more details might appear in the Das Protokoll-Bedienfeld.