23.2.8. Vector miscellaneous

23.2.8.1. Executar SQL

Runs a simple or complex query with SQL syntax on the source layer. The result of the query will be added as a new layer.

This algorithm is derived from the GDAL ogr2ogr utility.

23.2.8.1.1. Parâmetros

Etiqueta

Nome

Tipo

Descrição

Camada de entrada

ENTRADA

[vector: any]

OGR-supported input vector layer

SQL expression

SQL

[string]

Defines the SQL query, for example SELECT * FROM my_table WHERE name is not null.

SQL dialect

DIALECT

[enumeration]

Padrão: 0

SQL dialect to use. One of:

  • 0 — None

  • 1 — OGR SQL

  • 2 — SQLite

Opções de criação adicionais

(opcional)

OPÇÕES

[string]

Padrão: ‘’ (sem opções adicionais)

Opções adicionais de criação de GDAL.

SQL result

SAÍDA

[vector: any]

Especificação da camada de saída. Uma de:

  • Salvar como Arquivo Temporário

  • Salvar para Arquivo…

A codificação do arquivo também pode ser alterada aqui.

For Save to File, the output format has to be specified. All GDAL vector formats are supported. For Save to a Temporary File the default output vector layer format will be used.

23.2.8.1.2. Saídas

Etiqueta

Nome

Tipo

Descrição

SQL result

SAÍDA

[vector: any]

Camada vetorial criada pela consulta

23.2.8.1.3. Python code

Algorithm ID: gdal:executesql

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 Usando os algoritmos do processamento a partir do Terminal Python. for details on how to run processing algorithms from the Python console.

23.2.8.2. Export to PostgreSQL (available connections)

Imports vector layers inside a PostgreSqL database on the basis of an available connection. The connection has to be defined properly beforehand. Be aware that the checkboxes ‘Save Username’ and ‘Save Password’ are activated. Then you can use the algorithm.

This algorithm is derived from the GDAL ogr2ogr utility.

23.2.8.2.1. Parâmetros

Etiqueta

Nome

Tipo

Descrição

Banco de dados (nome da conexão)

BANCO DE DADOS

[string]

The PostgreSQL database to connect to

Camada de entrada

ENTRADA

[vector: any]

OGR-supported vector layer to export to the database

Shape encoding

Opcional

SHAPE_ENCODING

[string]

Padrão: ‘’

Sets the encoding to apply to the data

Tipo de geometria de saída

GTYPE

[enumeration]

Padrão: 0

Defines the output geometry type. One of:

  • 0 —

  • 1 — NONE

  • 2 — GEOMETRY

  • 3 — POINT

  • 4 — LINESTRING

  • 5 — POLYGON

  • 6 — GEOMETRYCOLLECTION

  • 7 — MULTIPOINT

  • 8 — MULTIPOLYGON

  • 9 — MULTILINESTRING

Assign an output CRS

Opcional

A_SRS

[crs]

Padrão: Nenhum

Defines the output CRS of the database table

Reproject to this CRS on output

Opcional

T_SRS

[crs]

Padrão: Nenhum

Reprojects/transforms to this CRS on output

Override source CRS

Opcional

S_SRS

[crs]

Padrão: Nenhum

Overrides the input layer CRS

Esquema (nome do esquema)

Opcional

ESQUEMA

[string]

Padrão: ‘público’

Defines the schema for the database table

Table to export to (leave blank to use layer name)

Opcional

TABELA

[string]

Padrão: ‘’

Defines a name for the table that will be imported into the database. By default the table name is the name of the input vector file.

Primary Key (new field)

Opcional

PK

[string]

Default: ‘id’

Defines which attribute field will be the primary key of the database table

Primary Key (existing field, used if the above option is left empty)

Opcional

PRIMARY_KEY

[tablefield: any]

Padrão: Nenhum

Defines which attribute field in the exported layer will be the primary key of the database table

Nome da coluna geometria

Opcional

GEOCOLUMN

[string]

Padrão: ‘geom’

Defines in which attribute field of the database there will be the geometry information

Vector dimensions

Opcional

DIM

[enumeration]

Default: 0 (2D)

Defines if the vector file to be imported has 2D or 3D data. One of:

  • 0 — 2

  • 1 — 3

Distance tolerance for simplification

Opcional

SIMPLIFY

[string]

Padrão: ‘’

Defines a distance tolerance for the simplification of the vector geometries to be imported. By default there is no simplification.

Maximum distance between 2 nodes (densification)

Opcional

SEGMENTIZE

[string]

Padrão: ‘’

The maximum distance between two nodes. Used to create intermediate points. By default there is no densification.

Select features by extent (defined in input layer CRS)

Opcional

SPAT

[extent]

Padrão: Nenhum

You can select features from a given extent that will be in the output table.

Clip the input layer using the above (rectangle) extent

Opcional

CLIP

[boolean]

Padrão: Falso

The input layer will be clipped by the extent you defined before

Select features using a SQL “WHERE” statement (Ex: column=”value”)

Opcional

WHERE

[string]

Padrão: ‘’

Defines with a SQL “WHERE” statement which features should be selected from the input layer

Group N features per transaction (Default: 2000)

Opcional

GT

[string]

Padrão: ‘’

You can group the input features in transactions where N defines the size. By default N limits the transaction size to 20000 features.

Overwrite existing table

Opcional

OVERWRITE

[boolean]

Padrão: Verdadeiro

If there is a table with the same name in the database, and if this option is set to True, the table will be overwritten.

Append to existing table

Opcional

APPEND

[boolean]

Padrão: Falso

If checked / True the vector data will be appended to an existing table. New fields found in the input layer are ignored. By default a new table will be created.

Append and add new fields to existing table

Opcional

ADDFIELDS

[boolean]

Padrão: Falso

If activated the vector data will be appended to an existing table, there won’t be a new table created. New fields found in input layer are added to the table. By default a new table will be created.

Do not launder columns/table names

Opcional

LAUNDER

[boolean]

Padrão: Falso

With this option checked you can prevent the default behaviour (converting column names to lowercase, removing spaces and other invalid characters).

Do not create Spatial Index

Opcional

INDEX

[boolean]

Padrão: Falso

Prevents a spatial index for the output table from being created. By default, a spatial index is added.

Continue after a failure, skipping the failed feature

Opcional

SKIPFAILURES

[boolean]

Padrão: Falso

Promote to Multipart

Opcional

PROMOTETOMULTI

[boolean]

Padrão: Verdadeiro

Casts features geometry type to multipart in the output table

Keep width and precision of input attributes

Opcional

PRECISION

[boolean]

Padrão: Verdadeiro

Avoids modifying column attributes to comply with input data

Opções de criação adicionais

(opcional)

OPÇÕES

[string]

Padrão: ‘’ (sem opções adicionais)

Opções adicionais de criação de GDAL.

23.2.8.2.2. Saídas

This algorithm has no output.

23.2.8.2.3. Python code

Algorithm ID: gdal:importvectorintopostgisdatabaseavailableconnections

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 Usando os algoritmos do processamento a partir do Terminal Python. for details on how to run processing algorithms from the Python console.

23.2.8.3. Export to PostgreSQL (new connection)

Imports vector layers inside a PostGreSQL database. A new connection to the PostGIS database must be created.

This algorithm is derived from the GDAL ogr2ogr utility.

23.2.8.3.1. Parâmetros

Etiqueta

Nome

Tipo

Descrição

Camada de entrada

ENTRADA

[vector: any]

OGR-supported vector layer to export to the database

Shape encoding

Opcional

SHAPE_ENCODING

[string]

Padrão: ‘’

Sets the encoding to apply to the data

Tipo de geometria de saída

GTYPE

[enumeration]

Padrão: 0

Defines the output geometry type. One of:

  • 0 —

  • 1 — NONE

  • 2 — GEOMETRY

  • 3 — POINT

  • 4 — LINESTRING

  • 5 — POLYGON

  • 6 — GEOMETRYCOLLECTION

  • 7 — MULTIPOINT

  • 8 — MULTIPOLYGON

  • 9 — MULTILINESTRING

Assign an output CRS

Opcional

A_SRS

[crs]

Padrão: Nenhum

Defines the output CRS of the database table

Reproject to this CRS on output

Opcional

T_SRS

[crs]

Padrão: Nenhum

Reprojects/transforms to this CRS on output

Override source CRS

Opcional

S_SRS

[crs]

Padrão: Nenhum

Overrides the input layer CRS

Host

Opcional

HOST

[string]

Default: ‘localhost’

Name of the database host

Port

Opcional

PORT

[string]

Default: ‘5432’

Port number the PostgreSQL database server listens on

Username

Opcional

USER

[string]

Padrão: ‘’

User name used to log in to the database

Database name

Opcional

DBNAME

[string]

Padrão: ‘’

Name of the database

Password

Opcional

PASSWORD

[string]

Padrão: ‘’

Password used with Username to connect to the database

Esquema (nome do esquema)

Opcional

ESQUEMA

[string]

Padrão: ‘público’

Defines the schema for the database table

Table name, leave blank to use input name

Opcional

TABELA

[string]

Padrão: ‘’

Defines a name for the table that will be imported into the database. By default the table name is the name of the input vector file.

Primary Key (new field)

Opcional

PK

[string]

Default: ‘id’

Defines which attribute field will be the primary key of the database table

Primary Key (existing field, used if the above option is left empty)

Opcional

PRIMARY_KEY

[tablefield: any]

Padrão: Nenhum

Defines which attribute field in the exported layer will be the primary key of the database table

Nome da coluna geometria

Opcional

GEOCOLUMN

[string]

Padrão: ‘geom’

Defines in which attribute field to store the geometry information

Vector dimensions

Opcional

DIM

[enumeration]

Default: 0 (2D)

Defines if the vector file to be imported has 2D or 3D data. One of:

  • 0 — 2D

  • 1 — 3D

Distance tolerance for simplification

Opcional

SIMPLIFY

[string]

Padrão: ‘’

Defines a distance tolerance for the simplification of the vector geometries to be imported. By default no simplification there is no simplification.

Maximum distance between 2 nodes (densification)

Opcional

SEGMENTIZE

[string]

Padrão: ‘’

The maximum distance between two nodes. Used to create intermediate points. By default there is no densification.

Select features by extent (defined in input layer CRS)

Opcional

SPAT

[extent]

Padrão: Nenhum

You can select features from a given extent that will be in the output table.

Clip the input layer using the above (rectangle) extent

Opcional

CLIP

[boolean]

Padrão: Falso

The input layer will be clipped by the extent you defined before

Fields to include (leave empty to use all fields)

Opcional

CAMPOS

[string] [list]

Padrão: []

Defines fields to keep from the imported vector file. If none is selected, all the fields are imported.

Select features using a SQL “WHERE” statement (Ex: column=”value”)

Opcional

WHERE

[string]

Padrão: ‘’

Defines with a SQL “WHERE” statement which features should be selected for the output table

Group N features per transaction (Default: 2000)

Opcional

GT

[string]

Padrão: ‘’

You can group the input features in transactions where N defines the size. By default N limits the transaction size to 20000 features.

Overwrite existing table

Opcional

OVERWRITE

[boolean]

Padrão: Verdadeiro

If there is a table with the same name in the database, and if this option is set to True, the table will be overwritten.

Append to existing table

Opcional

APPEND

[boolean]

Padrão: Falso

If checked / True the vector data will be appended to an existing table. New fields found in the input layer are ignored. By default a new table will be created.

Append and add new fields to existing table

Opcional

ADDFIELDS

[boolean]

Padrão: Falso

If activated the vector data will be appended to an existing table, there won’t be created a new table. New fields found in input layer are added to the table. By default a new table will be created.

Do not launder columns/table names

Opcional

LAUNDER

[boolean]

Padrão: Falso

With this option checked you can prevent the default behaviour (converting column names to lowercase, removing spaces and other invalid characters).

Do not create Spatial Index

Opcional

INDEX

[boolean]

Padrão: Falso

Prevents a spatial index for the output table from being created. By default, a spatial index is added.

Continue after a failure, skipping the failed feature

Opcional

SKIPFAILURES

[boolean]

Padrão: Falso

Promote to Multipart

Opcional

PROMOTETOMULTI

[boolean]

Padrão: Verdadeiro

Casts features geometry type to multipart in the output table

Keep width and precision of input attributes

Opcional

PRECISION

[boolean]

Padrão: Verdadeiro

Avoids modifying column attributes to comply with input data

Opções de criação adicionais

(opcional)

OPÇÕES

[string]

Padrão: ‘’ (sem opções adicionais)

Opções adicionais de criação de GDAL.

23.2.8.3.2. Saídas

This algorithm has no output.

23.2.8.3.3. Python code

Algorithm ID: gdal:importvectorintopostgisdatabasenewconnection

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 Usando os algoritmos do processamento a partir do Terminal Python. for details on how to run processing algorithms from the Python console.

23.2.8.4. Vector Information

Creates an information file that lists information about an OGR-supported data source. The output will be shown in a ‘Result’ window and can be written into a HTML-file. The information includes the geometry type, feature count, the spatial extent, the projection information and many more.

This algorithm is derived from the GDAL ogrinfo utility.

23.2.8.4.1. Parâmetros

Etiqueta

Nome

Tipo

Descrição

Camada de entrada

ENTRADA

[vector: any]

Camada vetorial de entrada

Summary output only

Opcional

SUMMARY_ONLY

[boolean]

Padrão: Verdadeiro

Suprimir informação dos metadados

Opcional

SEM_METADADOS

[boolean]

Padrão: Falso

Informação da camada

SAÍDA

[html]

Default: [Save to temporary file]

Specify the output HTML file that includes the file information. One of:

  • Salvar como Arquivo Temporário

  • Salvar para Arquivo…

The file encoding can also be changed here. If no HTML-file is defined the output will be written to a temporary file

23.2.8.4.2. Saídas

Etiqueta

Nome

Tipo

Descrição

Informação da camada

SAÍDA

[html]

The output HTML-file that includes the file information.

23.2.8.4.3. Python code

Algorithm ID: gdal:ogrinfo

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 Usando os algoritmos do processamento a partir do Terminal Python. for details on how to run processing algorithms from the Python console.