24.1.18. Vector table

24.1.18.1. Add autoincremental field

Aggiunge un nuovo campo di numero intero a un layer vettoriale, con un valore sequenziale per ogni elemento.

This field can be used as a unique ID for features in the layer. The new attribute is not added to the input layer but a new layer is generated instead.

The initial starting value for the incremental series can be specified. Optionally, the incremental series can be based on grouping fields and a sort order for features can also be specified.

24.1.18.1.1. Parametri

Etichetta

Nome

Tipo

Descrizione

Layer in ingresso

IN INGRESSO

[vector: any]

Il layer dei vettori in ingresso.

Nome Campo

FIELD_NAME

[string]

Predefinito: “AUTO”

Nome del campo con valori autoincrementali

Valori di partenza a

Opzionale

START

[number]

Predefinito: 0

Scegli il numero iniziale per il conteggio incrementale

Raggruppa i valori per

Opzionale

GROUP_FIELDS

[tablefield: any] [list]

Select grouping field(s): instead of a single count run for the whole layer, a separate count is processed for each value returned by the combination of these fields.

Espressione di ordinamento

Opzionale

SORT_EXPRESSION

[expression]

Use an expression to sort the features in the layer either globally or if set, based on group fields.

Ordinamento ascendente

SORT_ASCENDING

[boolean]

Predefinito: True

When a sort expression is set, use this option to control the order in which features are assigned values.

Ordina i nulli come primi

SORT_NULLS_FIRST

[boolean]

Predefinito: False

When a sort expression is set, use this option to set whether Null values are counted first or last.

Crescente

OUTPUT

[same as input]

Predefinito: [Create temporary layer]

Specify the output vector layer with the auto increment field. One of:

  • Crea layer temporaneo (TEMPORARY_OUTPUT)

  • Salva come File…

  • Salva come Geopackage…

  • Salva su Tabella PostGIS…

La codifica del file può anche essere cambiata qui.

24.1.18.1.2. In uscita:

Etichetta

Nome

Tipo

Descrizione

Crescente

OUTPUT

[same as input]

Layer vettoriale con campo auto incrementale

24.1.18.1.3. Python code

ID Algoritmo: qgis:addautoincrementalfield

import processing
processing.run("algorithm_id", {parameter_dictionary})

The algorithm id is displayed when you hover over the algorithm in the Processing Toolbox. The parameter dictionary provides the parameter NAMEs and values. See Usare gli algoritmi di Processing dalla console dei comandi for details on how to run processing algorithms from the Python console.

24.1.18.2. Aggiungi un campo alla tabella degli attributi

Aggiunge un nuovo campo ad un layer vettoriale.

Il nome e le caratteristiche dell’attributo vengono definiti come parametri.

The new attribute is not added to the input layer but a new layer is generated instead.

24.1.18.2.1. Parametri

Etichetta

Nome

Tipo

Descrizione

Layer in ingresso

IN INGRESSO

[vector: any]

Il layer in ingresso

Nome Campo

FIELD_NAME

[string]

Name of the new field

Field type

FIELD_TYPE

[enumeration]

Predefinito: 0

Type of the new field. You can choose between:

  • 0 — Integer

  • 1 — Float

  • 2 — String

Lunghezza Campo

FIELD_LENGTH

[number]

Predefinito: 10

Lunghezza del campo

Precisione Campo

FIELD_PRECISION

[number]

Predefinito: 0

Precisione del campo. Utile con il tipo di campo Float (numero reale).

Added

OUTPUT

[same as input]

Predefinito: [Create temporary layer]

Specifica il layer vettoriale in uscita. Uno di:

  • Crea layer temporaneo (TEMPORARY_OUTPUT)

  • Salva come File…

  • Salva come Geopackage…

  • Salva su tabella PostGIS……

La codifica del file può anche essere cambiata qui.

24.1.18.2.2. In uscita:

Etichetta

Nome

Tipo

Descrizione

Added

OUTPUT

[same as input]

Vector layer with new field added

24.1.18.2.3. Python code

ID Algoritmo: qgis:addfieldtoattributestable

import processing
processing.run("algorithm_id", {parameter_dictionary})

The algorithm id is displayed when you hover over the algorithm in the Processing Toolbox. The parameter dictionary provides the parameter NAMEs and values. See Usare gli algoritmi di Processing dalla console dei comandi for details on how to run processing algorithms from the Python console.

24.1.18.3. Add unique value index field

Takes a vector layer and an attribute and adds a new numeric field.

Values in this field correspond to values in the specified attribute, so features with the same value for the attribute will have the same value in the new numeric field.

This creates a numeric equivalent of the specified attribute, which defines the same classes.

The new attribute is not added to the input layer but a new layer is generated instead.

24.1.18.3.1. Parametri

Etichetta

Nome

Tipo

Descrizione

Layer in ingresso

IN INGRESSO

[vector: any]

The input layer.

Class field

FIELD

[tablefield: any]

Elementi che hanno lo stesso valore per questo campo avranno lo stesso indice.

Output field name

FIELD_NAME

[string]

Predefinito: “NUM_FIELD”

Name of the new field containing the indexes.

Layer with index field

OUTPUT

[vector: any]

Predefinito: [Create temporary layer]

Vector layer with the numeric field containing indexes. One of:

  • Skip Output

  • Create Temporary Layer

  • Salva come File…

  • Salva come Geopackage…

  • Salva su tabella PostGIS……

La codifica del file può anche essere cambiata qui.

Class summary

SUMMARY_OUTPUT

[table]

Predefinito: [Skip output]

Specify the table to contain the summary of the class field mapped to the corresponding unique value. One of:

  • Skip Output

  • Create Temporary Layer

  • Salva come File…

  • Salva come Geopackage…

  • Salva su tabella PostGIS……

La codifica del file può anche essere cambiata qui.

24.1.18.3.2. In uscita:

Etichetta

Nome

Tipo

Descrizione

Layer with index field

OUTPUT

[same as input]

Vector layer with the numeric field containing indexes.

Class summary

SUMMARY_OUTPUT

[table]

Default: [Skip Output]

Table with summary of the class field mapped to the corresponding unique value.

24.1.18.3.3. Python code

ID Algoritmo: qgis:adduniquevalueindexfield

import processing
processing.run("algorithm_id", {parameter_dictionary})

The algorithm id is displayed when you hover over the algorithm in the Processing Toolbox. The parameter dictionary provides the parameter NAMEs and values. See Usare gli algoritmi di Processing dalla console dei comandi for details on how to run processing algorithms from the Python console.

24.1.18.4. Add X/Y fields to layer

Adds X and Y (or latitude/longitude) fields to a point layer. The X/Y fields can be calculated in a different CRS to the layer (e.g. creating latitude/longitude fields for a layer in a projected CRS).

24.1.18.4.1. Parametri

Etichetta

Nome

Tipo

Descrizione

Layer in ingresso

IN INGRESSO

[vector: point]

The input layer.

Sistemi di Coordinate

CRS

[crs]

Predefinito: «EPSG:4326»

Coordinate reference system to use for the generated x and y fields.

Field prefix

Opzionale

PREFIX

[string]

Prefix to add to the new field names to avoid name collisions with fields in the input layer.

Added fields

OUTPUT

[vector: point]

Predefinito: [Create temporary layer]

Specify the output layer. One of:

  • Create Temporary Layer

  • Salva come File…

  • Salva come Geopackage…

  • Salva su Tabella PostGIS…

La codifica del file può anche essere cambiata qui.

24.1.18.4.2. In uscita:

Etichetta

Nome

Tipo

Descrizione

Added fields

OUTPUT

[vector: point]

The output layer - identical to the input layer but with two new double fields, x and y.

24.1.18.4.3. Python code

ID Algoritmo: qgis:addxyfieldstolayer

import processing
processing.run("algorithm_id", {parameter_dictionary})

The algorithm id is displayed when you hover over the algorithm in the Processing Toolbox. The parameter dictionary provides the parameter NAMEs and values. See Usare gli algoritmi di Processing dalla console dei comandi for details on how to run processing algorithms from the Python console.

24.1.18.5. Advanced Python field calculator

Adds a new attribute to a vector layer, with values resulting from applying an expression to each feature.

The expression is defined as a Python function.

24.1.18.5.1. Parametri

Etichetta

Nome

Tipo

Descrizione

Layer in ingresso

IN INGRESSO

[vector: any]

Livello vettoriale in ingresso

Result field name

FIELD_NAME

[string]

Predefinito: “NewField”

Name of the new field

Field type

FIELD_TYPE

[enumeration]

Predefinito: 0

Type of the new field. One of:

  • 0 — Integer

  • 1 — Float

  • 2 — String

Lunghezza Campo

FIELD_LENGTH

[number]

Predefinito: 10

Lunghezza del campo

Precisione Campo

FIELD_PRECISION

[number]

Predefinito: 3

Precisione del campo. Utile con il tipo di campo Float (numero reale).

Global expression

Opzionale

GLOBAL

[string]

The code in the global expression section will be executed only once before the calculator starts iterating through all the features of the input layer. Therefore, this is the correct place to import necessary modules or to calculate variables that will be used in subsequent calculations.

Formula

FORMULA

[string]

The Python formula to evaluate. Example: To calculate the area of an input polygon layer you can add:

value = $geom.area()

Calculated

OUTPUT

[same as input]

Predefinito: [Create temporary layer]

Specify the vector layer with the new calculated field. One of:

  • Create Temporary Layer

  • Salva come File…

  • Salva come Geopackage…

  • Salva su tabella PostGIS……

La codifica del file può anche essere cambiata qui.

24.1.18.5.2. In uscita:

Etichetta

Nome

Tipo

Descrizione

Calculated

OUTPUT

[same as input]

Vector layer with the new calculated field

24.1.18.5.3. Python code

ID Algoritmo: qgis:advancedpythonfieldcalculator

import processing
processing.run("algorithm_id", {parameter_dictionary})

The algorithm id is displayed when you hover over the algorithm in the Processing Toolbox. The parameter dictionary provides the parameter NAMEs and values. See Usare gli algoritmi di Processing dalla console dei comandi for details on how to run processing algorithms from the Python console.

24.1.18.6. Drop field(s)

Takes a vector layer and generates a new one that has the same features but without the selected columns.

24.1.18.6.1. Parametri

Etichetta

Nome

Tipo

Descrizione

Layer in ingresso

IN INGRESSO

[vector: any]

Input vector layer to drop field(s) from

Fields to drop

COLUMN

[tablefield: any] [list]

The field(s) to drop

Remaining fields

OUTPUT

[same as input]

Predefinito: [Create temporary layer]

Specify the output vector layer with the remaining fields. One of:

  • Create Temporary Layer

  • Salva come File…

  • Salva come Geopackage…

  • Salva su tabella PostGIS……

La codifica del file può anche essere cambiata qui.

24.1.18.6.2. In uscita:

Etichetta

Nome

Tipo

Descrizione

Remaining fields

OUTPUT

[same as input]

Vector layer with the remaining fields

24.1.18.6.3. Python code

ID Algoritmo: qgis:deletecolumn

import processing
processing.run("algorithm_id", {parameter_dictionary})

The algorithm id is displayed when you hover over the algorithm in the Processing Toolbox. The parameter dictionary provides the parameter NAMEs and values. See Usare gli algoritmi di Processing dalla console dei comandi for details on how to run processing algorithms from the Python console.

24.1.18.7. Explode HStore Field

Creates a copy of the input layer and adds a new field for every unique key in the HStore field.

The expected field list is an optional comma separated list. If this list is specified, only these fields are added and the HStore field is updated. By default, all unique keys are added.

The PostgreSQL HStore is a simple key-value store used in PostgreSQL and OGR (when reading an OSM file with the other_tags field.

24.1.18.7.1. Parametri

Etichetta

Nome

Tipo

Descrizione

Layer in ingresso

IN INGRESSO

[vector: any]

Livello vettoriale in ingresso

HStore field

FIELD

[tablefield: any]

The field(s) to drop

Expected list of fields separated by a comma

Opzionale

EXPECTED_FIELDS

[string]

Predefinito: “”

Comma-separated list of fields to extract. The HStore field will be updated by removing these keys.

Exploded

OUTPUT

[same as input]

Predefinito: [Create temporary layer]

Specifica il layer vettoriale in uscita. Uno di:

  • Create Temporary Layer

  • Salva come File…

  • Salva come Geopackage…

  • Salva su tabella PostGIS……

La codifica del file può anche essere cambiata qui.

24.1.18.7.2. In uscita:

Etichetta

Nome

Tipo

Descrizione

Exploded

OUTPUT

[same as input]

Output vector layer

24.1.18.7.3. Python code

ID Algoritmo: qgis:explodehstorefield

import processing
processing.run("algorithm_id", {parameter_dictionary})

The algorithm id is displayed when you hover over the algorithm in the Processing Toolbox. The parameter dictionary provides the parameter NAMEs and values. See Usare gli algoritmi di Processing dalla console dei comandi for details on how to run processing algorithms from the Python console.

24.1.18.8. Extract binary field

Extracts contents from a binary field, saving them to individual files. Filenames can be generated using values taken from an attribute in the source table or based on a more complex expression.

24.1.18.8.1. Parametri

Etichetta

Nome

Tipo

Descrizione

Layer in ingresso

IN INGRESSO

[vector: any]

Input vector layer containing the binary data

Campo binario

FIELD

[tablefield: any]

Campo contenente i dati binari

File name

FILENAME

[expression]

Field or expression-based text to name each output file

Destination folder

FOLDER

[folder]

Predefinito: [Save to a temporary folder]

Folder in which to store the output files. One of:

  • Save to a Temporary Directory

  • Save to Directory…

La codifica del file può anche essere cambiata qui.

24.1.18.8.2. In uscita:

Etichetta

Nome

Tipo

Descrizione

Folder

FOLDER

[folder]

La cartella che contiene i file in uscita.

24.1.18.8.3. Python code

ID Algoritmo: qgis:extractbinary

import processing
processing.run("algorithm_id", {parameter_dictionary})

The algorithm id is displayed when you hover over the algorithm in the Processing Toolbox. The parameter dictionary provides the parameter NAMEs and values. See Usare gli algoritmi di Processing dalla console dei comandi for details on how to run processing algorithms from the Python console.

24.1.18.9. Feature filter

Filters features from the input layer and redirects them to one or several outputs. If you do not know about any attribute names that are common to all possible input layers, filtering is only possible on the feature geometry and general record mechanisms, such as $id and uuid.

Nota

Questo algoritmo è disponibile solo nel Graphical modeler.

24.1.18.9.1. Parametri

Etichetta

Nome

Tipo

Descrizione

Layer in ingresso

IN INGRESSO

[vector: any]

The input layer.

Outputs and filters

(one or more)

OUTPUT_<name of the filter>

[same as input]

The output layers with filters (as many as there are filters).

24.1.18.9.2. In uscita:

Etichetta

Nome

Tipo

Descrizione

Output

(one or more)

native:filter_1:OUTPUT_<name of filter>

[same as input]

The output layers with filtered features (as many as there are filters).

24.1.18.9.3. Python code

ID Algoritmo: qgis:featurefilter

import processing
processing.run("algorithm_id", {parameter_dictionary})

The algorithm id is displayed when you hover over the algorithm in the Processing Toolbox. The parameter dictionary provides the parameter NAMEs and values. See Usare gli algoritmi di Processing dalla console dei comandi for details on how to run processing algorithms from the Python console.

24.1.18.10. Field calculator

Opens the field calculator (see Espressioni). You can use all the supported expressions and functions.

A new layer is created with the result of the expression.

The field calculator is very useful when used in Il modellatore grafico.

24.1.18.10.1. Parametri

Etichetta

Nome

Tipo

Descrizione

Layer in ingresso

IN INGRESSO

[vector: any]

The layer to calculate on

Output field name

FIELD_NAME

[string]

The name of the field for the results

Output field type

FIELD_TYPE

[enumeration]

Predefinito: 0

The type of the field. One of:

  • 0 — Reale

  • 1 — Intero

  • 2 — String

  • 3 — Data

Output field width

FIELD_LENGTH

[number]

Predefinito: 10

The length of the result field (minimum 0)

Precisione Campo

FIELD_PRECISION

[number]

Predefinito: 3

The precision of the result field (minimum 0, maximum 15)

Create new field

NEW_FIELD

[boolean]

Predefinito: True

Should the result field be a new field

Formula

FORMULA

[expression]

The formula to use to calculate the result

Output file

OUTPUT

[vector: any]

Predefinito: [Save to temporary file]

Specification of the output layer.

24.1.18.10.2. In uscita:

Etichetta

Nome

Tipo

Descrizione

Calculated

OUTPUT

[vector: any]

Output layer with the calculated field values

24.1.18.10.3. Python code

ID Algoritmo: qgis:fieldcalculator

import processing
processing.run("algorithm_id", {parameter_dictionary})

The algorithm id is displayed when you hover over the algorithm in the Processing Toolbox. The parameter dictionary provides the parameter NAMEs and values. See Usare gli algoritmi di Processing dalla console dei comandi for details on how to run processing algorithms from the Python console.

24.1.18.11. Refactor fields

Allows editing the structure of the attribute table of a vector layer.

Fields can be modified in their type and name, using a fields mapping.

The original layer is not modified. A new layer is generated, which contains a modified attribute table, according to the provided fields mapping.

Refactor layer fields allows to:

  • Change field names and types

  • Aggiungere e rimuovere campi

  • Reorder fields

  • Calculate new fields based on expressions

  • Load field list from another layer

../../../../_images/refactor_fields.png

Fig. 24.96 Refactor fields dialog

24.1.18.11.1. Parametri

Etichetta

Nome

Tipo

Descrizione

Layer in ingresso

IN INGRESSO

[vector: any]

The layer to modify

Fields mapping

FIELDS_MAPPING

[list]

List of output fields with their definitions. The embedded table lists all the fields of the source layer and allows you to edit them:

  • Click newAttribute to create a new field.

  • Click deleteAttribute to remove a field.

  • Use arrowUp and arrowDown to change the selected field order.

  • Click clearText to reset to the default view.

For each of the fields you’d like to reuse, you need to fill the following options:

Source expression (expression) [expression]

Campo o espressione del vettore in ingresso.

Field name (name) [string]

Name of the field in the output layer. By default input field name is kept.

Type (type) [enumeration]

Data type of the output field. One of:

  • Date (14)

  • DateTime (16)

  • Double (6)

  • Integer (2)

  • Integer64 (4)

  • String (10)

  • Boolean (1)

Length (length) [number]

Lunghezza del campo in uscita.

Precision (precision) [number]

Precisione del campo in uscita.

Fields from another layer can be loaded into the field list in Load fields from layer.

Refactored

OUTPUT

[vector: any]

Predefinito: [Create temporary layer]

Specification of the output layer. One of:

  • Create Temporary Layer

  • Salva come File…

  • Salva come Geopackage…

  • Salva su tabella PostGIS……

La codifica del file può anche essere cambiata qui.

24.1.18.11.2. In uscita:

Etichetta

Nome

Tipo

Descrizione

Refactored

OUTPUT

[vector: any]

Output layer with refactored fields

24.1.18.11.3. Python code

ID Algoritmo: qgis:refactorfields

import processing
processing.run("algorithm_id", {parameter_dictionary})

The algorithm id is displayed when you hover over the algorithm in the Processing Toolbox. The parameter dictionary provides the parameter NAMEs and values. See Usare gli algoritmi di Processing dalla console dei comandi for details on how to run processing algorithms from the Python console.

24.1.18.12. Rename vector field

Renames an existing field from a vector layer.

The original layer is not modified. A new layer is generated where the attribute table contains the renamed field.

Vedi anche

Refactor fields

24.1.18.12.1. Parametri

Etichetta

Nome

Tipo

Descrizione

Layer in ingresso

IN INGRESSO

[vector: any]

The input vector layer

Campo da rinominare

FIELD

[string]

The field to be altered

New field name

NEW_NAME

[string]

The new field name

Rinominato

OUTPUT

[vector: same as input]

Predefinito: [Create temporary layer]

Specification of the output layer. One of:

  • Create Temporary Layer

  • Salva come File…

  • Salva come Geopackage…

  • Salva su tabella PostGIS……

La codifica del file può anche essere cambiata qui.

24.1.18.12.2. In uscita:

Etichetta

Nome

Tipo

Descrizione

Rinominato

OUTPUT

[vector: same as input]

Output layer with the renamed field

24.1.18.12.3. Python code

ID Algoritmo: qgis:renametablefield

import processing
processing.run("algorithm_id", {parameter_dictionary})

The algorithm id is displayed when you hover over the algorithm in the Processing Toolbox. The parameter dictionary provides the parameter NAMEs and values. See Usare gli algoritmi di Processing dalla console dei comandi for details on how to run processing algorithms from the Python console.

24.1.18.13. Text to float

Modifies the type of a given attribute in a vector layer, converting a text attribute containing numeric strings into a numeric attribute (e.g. “1” to 1.0).

The algorithm creates a new vector layer so the source one is not modified.

If the conversion is not possible the selected column will have NULL values.

24.1.18.13.1. Parametri

Etichetta

Nome

Tipo

Descrizione

Layer in ingresso

IN INGRESSO

[vector: any]

Il layer dei vettori in ingresso.

Text attribute to convert to float

FIELD

[tablefield: string]

The string field for the input layer that is to be converted to a float field.

Da stringa a numerico reale

OUTPUT

[same as input]

Default: [Create Temporary Layer]

Specify the output layer. One of:

  • Create Temporary Layer

  • Salva come File…

  • Salva come Geopackage…

  • Salva su tabella PostGIS……

La codifica del file può anche essere cambiata qui.

24.1.18.13.2. In uscita:

Etichetta

Nome

Tipo

Descrizione

Da stringa a numerico reale

OUTPUT

[same as input]

Layer vettoriale di uscita con il campo stringa convertito in un campo float

24.1.18.13.3. Python code

ID Algoritmo: qgis:texttofloat`

import processing
processing.run("algorithm_id", {parameter_dictionary})

The algorithm id is displayed when you hover over the algorithm in the Processing Toolbox. The parameter dictionary provides the parameter NAMEs and values. See Usare gli algoritmi di Processing dalla console dei comandi for details on how to run processing algorithms from the Python console.