Fontos

A fordítás közösségi munka eredménye, amelyhez itt tudsz csatlakozni <https://qgis.org/en/site/getinvolved/translate.html#becoming-a-translator>`_. Ennek az oldalnak eddig a 42.86% részét fordítottuk le.

28.1.3. Adatbázis

28.1.3.1. Export to PostgreSQL

Exports a vector layer to a PostgreSQL database, creating a new relation. If a relation with the same name exists, it can be removed before the new relation is created. Prior to this a connection between QGIS and the PostgreSQL database has to be created (see eg Creating a stored Connection).

Paraméterek

Címke

Név

Típus

Leírás

Layer to import

INPUT

[vector: any]

Vector layer to add to the database

Database (connection name)

DATABASE

[karakterlánc]

Name of the database connection (not the database name). Existing connections will be shown in the combobox.

Schema (schema name)

Optional

SCHEMA

[karakterlánc]

Default: «public»

Name of the schema to store the data. It can be a new one or already exist.

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

Optional

TABLENAME

[karakterlánc]

Default: «»

Defines a table name for the imported vector file. If nothing is added, the layer name will be used.

Primary key field

Optional

PRIMARY_KEY

[tablefield: any]

Sets the primary key field from an existing field in the vector layer. A column with unique values can be used as Primary key for the database.

Geometry column

GEOMETRY_COLUMN

[karakterlánc]

Default: «geom»

Defines the name of the geometry column in the new PostGIS table. Geometry information for the features is stored in this column.

Encoding

Optional

ENCODING

[karakterlánc]

Default: «UTF-8»

Defines the encoding of the output layer

Overwrite

OVERWRITE

[boolean]

Default: True

If the specified table exists, setting this option to True will make sure that it is deleted and a new table will be created before the features are added. If this option is False and the table exists, the algorithm will throw an exception („relation already exists”).

Create spatial index

CREATEINDEX

[boolean]

Default: True

Specifies whether to create a spatial index or not

Convert field names to lowercase

LOWERCASE_NAMES

[boolean]

Default: True

Converts the field names of the input vector layer to lowercase

Drop length constraint on character fields

DROP_STRING_LENGTH

[boolean]

Default: False

Should length constraints on character fields be dropped or not

Create single-part geometries instead of multi-part

FORCE_SINGLEPART

[boolean]

Default: False

Should the features of the output layer be single-part instead of multi-part. By default the existing geometries information are preserved.

Eredmények

The algorithm has no output.

Python kód

Algorithm ID: qgis:importintopostgis

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

Az algoritmus azonosító akkor jelenik meg, ha az egérmutatót az algoritmus fölé viszi a Feldolgozás eszköztáron. A paraméterszótár tartalmazza a paraméter NAME-eket és érékeket. A feldolgozási algoritmusok Python konzolról történő futtatásával kapcsolatos részletekért lásd a Using processing algorithms from the console fejezetet.

28.1.3.2. Export to SpatiaLite

Exports a vector layer to a SpatiaLite database. Prior to this a connection between QGIS and the SpatiaLite database has to be created (see eg SpatiaLite Layers).

Paraméterek

Címke

Név

Típus

Leírás

Layer to import

INPUT

[vector: any]

Vector layer to add to the database

File database

DATABASE

[vector: any]

The SQLite/SpatiaLite database file to connect to

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

Optional

TABLENAME

[karakterlánc]

Default: «»

Defines the table name for the imported vector file. If nothing is specified, the layer name will be used.

Primary key field

Optional

PRIMARY_KEY

[tablefield: any]

Use a field in the input vector layer as the primary key

Geometry column

GEOMETRY_COLUMN

[karakterlánc]

Default: «geom»

Defines the name of the geometry column in the new SpatiaLite table. Geometry information for the features is stored in this column.

Encoding

Optional

ENCODING

[karakterlánc]

Default: «UTF-8»

Defines the encoding of the output layer

Overwrite

OVERWRITE

[boolean]

Default: True

If the specified table exists, setting this option to True will make sure that it is deleted and a new table will be created before the features of the layer is added. If this option is False and the table exists, the algorithm will throw an exception („table already exists”).

Create spatial index

CREATEINDEX

[boolean]

Default: True

Specifies whether to create a spatial index or not

Convert field names to lowercase

LOWERCASE_NAMES

[boolean]

Default: True

Convert the field names of the input vector layer to lowercase

Drop length constraint on character fields

DROP_STRING_LENGTH

[boolean]

Default: False

Should length constraints on character fields be dropped or not

Create single-part geometries instead of multi-part

FORCE_SINGLEPART

[boolean]

Default: False

Should the features of the output layer be single-part instead of multi-part. By default the existing geometries information are preserved.

Eredmények

The algorithm has no output.

Python kód

Algorithm ID: qgis:importintospatialite

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

Az algoritmus azonosító akkor jelenik meg, ha az egérmutatót az algoritmus fölé viszi a Feldolgozás eszköztáron. A paraméterszótár tartalmazza a paraméter NAME-eket és érékeket. A feldolgozási algoritmusok Python konzolról történő futtatásával kapcsolatos részletekért lásd a Using processing algorithms from the console fejezetet.

28.1.3.3. Package layers

Adds layers to a GeoPackage.

If the GeoPackage exists and Overwrite existing GeoPackage is checked, it will be overwritten (removed and recreated). If the GeoPackage exists and Overwrite existing GeoPackage is not checked, the layer will be appended.

Paraméterek

Címke

Név

Típus

Leírás

Input rétegek

LAYERS

[vektor: bármi] [lista]

The (vector) layers to import into the GeoPackage. Raster layers are not supported. If a raster layer is added, a QgsProcessingException will be thrown.

Overwrite existing GeoPackage

OVERWRITE

[boolean]

Default: False

If the specified GeoPackage exists, setting this option to True will make sure that it is deleted and a new one will be created before the layers are added. If set to False, layers will be appended.

Save layer styles into GeoPackage

SAVE_STYLES

[boolean]

Default: True

Save the layer styles

Save only selected features

SELECTED_FEATURES_ONLY

[boolean]

Default: False

If a layer has a selection, setting this option to True will result in only selected features being saved. For layers without a selection all features will be saved.

Export related layers following relations defined in the project

EXPORT_RELATED_LAYERS

[boolean]

Default: False

If an input layer has relations set in the project, setting this option to True will result in exporting also its related layer(s). If the layer has features selected, then only their related features will be exported unless the related layer was also an input layer.

Destination GeoPackage

OUTPUT

[fájl]

Alapértelmezett: [Mentés ideiglenes fájlba]

Specify where to store the GeoPackage file. One of

  • Mentés ideiglenes fájlba

  • Mentés fájlba…

Eredmények

Címke

Név

Típus

Leírás

Layers within new package

OUTPUT_LAYERS

[string] [list]

The list of layers added to the GeoPackage.

Python kód

Algorithm ID: native:package

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

Az algoritmus azonosító akkor jelenik meg, ha az egérmutatót az algoritmus fölé viszi a Feldolgozás eszköztáron. A paraméterszótár tartalmazza a paraméter NAME-eket és érékeket. A feldolgozási algoritmusok Python konzolról történő futtatásával kapcsolatos részletekért lásd a Using processing algorithms from the console fejezetet.

28.1.3.4. PostgreSQL execute and load SQL

Allows a SQL database query to be performed on a PostgreSQL database connected to QGIS and loads the result. The algorithm won’t create a new layer: it is designed to run queries on the layer itself.

Példa

  1. Set all the values of an existing field to a fixed value. The SQL query string will be:

    UPDATE your_table SET field_to_update=20;
    

    In the example above, the values of the field field_to_update of the table your_table will be all set to 20.

  2. Create a new area column and calculate the area of each feature with the ST_AREA PostGIS function.

    -- Create the new column "area" on the table your_table"
    ALTER TABLE your_table ADD COLUMN area double precision;
    -- Update the "area" column and calculate the area of each feature:
    UPDATE your_table SET area=ST_AREA(geom);
    

Paraméterek

Címke

Név

Típus

Leírás

Database (connection name)

DATABASE

[karakterlánc]

The database connection (not the database name). Existing connections will be shown in the combobox.

SQL query

SQL

[karakterlánc]

Defines the SQL query, for example 'UPDATE my_table SET field=10'.

Unique ID field name

ID_FIELD

[karakterlánc]

Default: id

Sets the primary key field (a column in the result table)

Geometry field name

Optional

GEOMETRY_FIELD

[karakterlánc]

Default: «geom»

Name of the geometry column (a column in the result table)

Eredmények

Címke

Név

Típus

Leírás

SQL layer

OUTPUT

[vector: any]

The resulting vector layer to be loaded into QGIS.

Python kód

Algorithm ID: qgis:postgisexecuteandloadsql

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

Az algoritmus azonosító akkor jelenik meg, ha az egérmutatót az algoritmus fölé viszi a Feldolgozás eszköztáron. A paraméterszótár tartalmazza a paraméter NAME-eket és érékeket. A feldolgozási algoritmusok Python konzolról történő futtatásával kapcsolatos részletekért lásd a Using processing algorithms from the console fejezetet.

28.1.3.5. PostgreSQL execute SQL

Allows a SQL database query to be performed on a PostgreSQL database connected to QGIS. The algorithm won’t create a new layer: it is designed to run queries on the layer itself.

Példa

  1. Set all the values of an existing field to a fixed value. The SQL query string will be:

    UPDATE your_table SET field_to_update=20;
    

    In the example above, the values of the field field_to_update of the table your_table will be all set to 20.

  2. Create a new area column and calculate the area of each feature with the ST_AREA PostGIS function.

    -- Create the new column "area" on the table your_table"
    ALTER TABLE your_table ADD COLUMN area double precision;
    -- Update the "area" column and calculate the area of each feature:
    UPDATE your_table SET area=ST_AREA(geom);
    

Paraméterek

Címke

Név

Típus

Leírás

Database (connection name)

DATABASE

[karakterlánc]

The database connection (not the database name). Existing connections will be shown in the combobox.

SQL query

SQL

[karakterlánc]

Defines the SQL query, for example 'UPDATE my_table SET field=10'.

Eredmények

No output is created. The SQL query is executed in place.

Python kód

Algorithm ID: native:postgisexecutesql

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

Az algoritmus azonosító akkor jelenik meg, ha az egérmutatót az algoritmus fölé viszi a Feldolgozás eszköztáron. A paraméterszótár tartalmazza a paraméter NAME-eket és érékeket. A feldolgozási algoritmusok Python konzolról történő futtatásával kapcsolatos részletekért lásd a Using processing algorithms from the console fejezetet.

28.1.3.6. SpatiaLite execute SQL

Allows a SQL database query to be performed on a SpatiaLite database. The algorithm won’t create a new layer: it is designed to run queries on the layer itself.

Lásd még

PostgreSQL execute SQL, Execute SQL

For some SQL query examples see PostGIS SQL Query Examples.

Paraméterek

Címke

Név

Típus

Leírás

File Database

DATABASE

[vector]

The SQLite/SpatiaLite database file to connect to

SQL query

SQL

[karakterlánc]

Default: «»

Defines the SQL query, for example 'UPDATE my_table SET field=10'.

Eredmények

No output is created. The SQL query is executed in place.

Python kód

Algorithm ID: native:spatialiteexecutesql

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

Az algoritmus azonosító akkor jelenik meg, ha az egérmutatót az algoritmus fölé viszi a Feldolgozás eszköztáron. A paraméterszótár tartalmazza a paraméter NAME-eket és érékeket. A feldolgozási algoritmusok Python konzolról történő futtatásával kapcsolatos részletekért lásd a Using processing algorithms from the console fejezetet.

28.1.3.7. SpatiaLite execute SQL (registered DB)

Allows a SQL database query to be performed on a SpatiaLite database connected to QGIS. The algorithm won’t create a new layer: it is designed to run queries on the layer itself.

Lásd még

PostgreSQL execute SQL, Execute SQL

For some SQL query examples see PostGIS SQL Query Examples.

Paraméterek

Címke

Név

Típus

Leírás

Database

DATABASE

[felsorolás]

Default: not set

Select a SQLite/SpatiaLite database connected to the current session

SQL query

SQL

[karakterlánc]

Default: «»

Defines the SQL query, for example 'UPDATE my_table SET field=10'.

Eredmények

No output is created. The SQL query is executed in place.

Python kód

Algorithm ID: native:spatialiteexecutesqlregistered

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

Az algoritmus azonosító akkor jelenik meg, ha az egérmutatót az algoritmus fölé viszi a Feldolgozás eszköztáron. A paraméterszótár tartalmazza a paraméter NAME-eket és érékeket. A feldolgozási algoritmusok Python konzolról történő futtatásával kapcsolatos részletekért lásd a Using processing algorithms from the console fejezetet.