Svarbu

Vertimas yra bendruomenės pastangos, prie kurių jūs galite prisijungti. Šis puslapis šiuo metu išverstas 74.44%.

24.1.3. Duomenų bazės

24.1.3.1. Eksportuoti į PostgreSQL

Eksportuoja vektorinį sluoksnį į PostgreSQL duomenų bazę, sukuriant naują lenttelę. Jei lentelė tokiu pavadinimu jau yra, ją galima išimti prie kuriant naują. Prieš vykdant šį veiksmą turi būti sukurta jungtis tarp QGIS ir PostgreSQL duomenų bazės (žr. Creating a stored Connection).

Parametrai

Užrašas

Pavadinimas

Tipas

Aprašymas

Importuojamas sluoksnis

INPUT

[vektorius: bet koks]

Į duomenų bazę pridedamas vektorinis sluoksnis

Duomenų bazė (jungties pavadinimas)

DATABASE

[tekstas]

Duomenų bazės jungties pavadinimas (ne duomenų bazės pavadinimas). Iškrentančiame sąraše bus rodomos esamos jungtys.

Schema (schemos pavadinimas)

Pasirinktinis

SCHEMA

[tekstas]

Numatyta: ‚public‘

Pavadinimas schemos, kurioje reikia laikyti duomenis. Tai gali būti nauja arba jau esama schema.

Lentelė, į kurią importuojama (palikite tuščią, jei norite naudoti sluoksnio pavadinimą)

Pasirinktinis

TABLENAME

[tekstas]

Numatytas: ‚‘

Nustato importuojamo vektorinio failo lentelės pavadinimą. Jei niekas nenurodyta, bus naudojamas sluoksnio pavadinimas.

Pirminio rakto laukas

Pasirinktinis

PRIMARY_KEY

[tablefield: any]

Nustato pirminio rakto lauką pagal esamą vektorinio sluoksnio lauką. Stulpelis su unikaliomis reikšmėmis gali būti naudojamas kaip duomenų bazės Pirminis raktas.

Geometrijos stulpelis

GEOMETRY_COLUMN

[tekstas]

Numatytas: ‚geom‘

Nustato naujos PostGIS lentelės geometrijos stulpelio pavadinimą. Šiame stulpelyje saugoma geoobjektų geometrijos informacija.

Koduotė

Pasirinktinis

ENCODING

[tekstas]

Numatyta: ‚UTF-8‘

Nustato išvesties sluoksnio koduotę

Perrašyti

OVERWRITE

[boolean]

Numatytas: Taip

Jei nurodyta lentelė jau yra, nustačius šios parinkties reikšmę True užtikrins, kad ji bus ištrinta ir nauja lentelė sukurta prieš pridedant geoobjektus. Jei šios parinkties reikšmė False ir lentelė yra, algoritmas praneš klaidą („lentelė jau yra“).

Kurti erdvinį indeksą

CREATEINDEX

[boolean]

Numatytas: Taip

Nurodo kurti erdvinį indeksą ar ne

Keisti laukų pavadinimus į mažąsias raides

LOWERCASE_NAMES

[boolean]

Numatytas: Taip

Keičia įvesties vektorinio sluoksnio laukų pavadinimus į mažąsias raides

Išmesti tekstinių laukų ilgio apribojimus

DROP_STRING_LENGTH

[boolean]

Numatytas: ne

Ar reikia išmesti tekstinių laukų ilgio apribojimus

Kurti vienos dalies geometrijas vietoje kelių dalių

FORCE_SINGLEPART

[boolean]

Numatytas: ne

Ar išvesties sluoksnio geoobjektai turėtų būti vienos dalies vietoj kelių dalių. Pagal nutylėjimą išlaikoma esama geometrijų informacija.

Išvestys

Algoritmas neturi išvesties.

Pythono kodas

Algoritmo ID: qgis:importintopostgis

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

algoritmo id rodomas, kai užvedate pelę virš algoritmo apdorojimo įrankinėje. parametrų žodynas teikia parametrų pavadinimus ir reikšmes. Daugiau informacijos apie tai, kaip vykdyti apdorojimo algoritmus Pythono konsolėje rasite skyriuje Using processing algorithms from the console.

24.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).

Parametrai

Užrašas

Pavadinimas

Tipas

Aprašymas

Importuojamas sluoksnis

INPUT

[vektorius: bet koks]

Į duomenų bazę pridedamas vektorinis sluoksnis

File database

DATABASE

[vektorius: bet koks]

The SQLite/SpatiaLite database file to connect to

Lentelė, į kurią importuojama (palikite tuščią, jei norite naudoti sluoksnio pavadinimą)

Pasirinktinis

TABLENAME

[tekstas]

Numatytas: ‚‘

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

Pirminio rakto laukas

Pasirinktinis

PRIMARY_KEY

[tablefield: any]

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

Geometrijos stulpelis

GEOMETRY_COLUMN

[tekstas]

Numatytas: ‚geom‘

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

Koduotė

Pasirinktinis

ENCODING

[tekstas]

Numatyta: ‚UTF-8‘

Nustato išvesties sluoksnio koduotę

Perrašyti

OVERWRITE

[boolean]

Numatytas: Taip

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“).

Kurti erdvinį indeksą

CREATEINDEX

[boolean]

Numatytas: Taip

Nurodo kurti erdvinį indeksą ar ne

Keisti laukų pavadinimus į mažąsias raides

LOWERCASE_NAMES

[boolean]

Numatytas: Taip

Convert the field names of the input vector layer to lowercase

Išmesti tekstinių laukų ilgio apribojimus

DROP_STRING_LENGTH

[boolean]

Numatytas: ne

Ar reikia išmesti tekstinių laukų ilgio apribojimus

Kurti vienos dalies geometrijas vietoje kelių dalių

FORCE_SINGLEPART

[boolean]

Numatytas: ne

Ar išvesties sluoksnio geoobjektai turėtų būti vienos dalies vietoj kelių dalių. Pagal nutylėjimą išlaikoma esama geometrijų informacija.

Išvestys

Algoritmas neturi išvesties.

Pythono kodas

Algorithm ID: qgis:importintospatialite

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

algoritmo id rodomas, kai užvedate pelę virš algoritmo apdorojimo įrankinėje. parametrų žodynas teikia parametrų pavadinimus ir reikšmes. Daugiau informacijos apie tai, kaip vykdyti apdorojimo algoritmus Pythono konsolėje rasite skyriuje Using processing algorithms from the console.

24.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.

Parametrai

Užrašas

Pavadinimas

Tipas

Aprašymas

Įvesties sluoksniai

LAYERS

[vektorius: bet koks] [sąrašas]

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]

Numatytas: ne

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]

Numatytas: Taip

Save the layer styles

Save layer metadata into GeoPackage

SAVE_METADATA

[boolean]

Numatytas: Taip

If checked, copies the source layer metadata into the GeoPackage so it becomes the default metadata for the layer.

Save only selected features

SELECTED_FEATURES_ONLY

[boolean]

Numatytas: ne

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]

Numatytas: ne

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

[file]

Numatytas: [Įrašyti į laikiną failą]

Specify where to store the GeoPackage file. One of

  • Įrašyti į laikiną failą

  • Įrašyti į failą…

Išvestys

Užrašas

Pavadinimas

Tipas

Aprašymas

Layers within new package

OUTPUT_LAYERS

[string] [list]

The list of layers added to the GeoPackage.

Pythono kodas

Algorithm ID: native:package

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

algoritmo id rodomas, kai užvedate pelę virš algoritmo apdorojimo įrankinėje. parametrų žodynas teikia parametrų pavadinimus ir reikšmes. Daugiau informacijos apie tai, kaip vykdyti apdorojimo algoritmus Pythono konsolėje rasite skyriuje Using processing algorithms from the console.

24.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.

Pavyzdys

  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);
    

Parametrai

Užrašas

Pavadinimas

Tipas

Aprašymas

Duomenų bazė (jungties pavadinimas)

DATABASE

[tekstas]

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

SQL query

SQL

[tekstas]

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

Unique ID field name

ID_FIELD

[tekstas]

Default: id

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

Geometry field name

Pasirinktinis

GEOMETRY_FIELD

[tekstas]

Numatytas: ‚geom‘

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

Išvestys

Užrašas

Pavadinimas

Tipas

Aprašymas

SQL layer

OUTPUT

[vektorius: bet koks]

The resulting vector layer to be loaded into QGIS.

Pythono kodas

Algorithm ID: qgis:postgisexecuteandloadsql

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

algoritmo id rodomas, kai užvedate pelę virš algoritmo apdorojimo įrankinėje. parametrų žodynas teikia parametrų pavadinimus ir reikšmes. Daugiau informacijos apie tai, kaip vykdyti apdorojimo algoritmus Pythono konsolėje rasite skyriuje Using processing algorithms from the console.

24.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.

Pavyzdys

  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);
    

Parametrai

Užrašas

Pavadinimas

Tipas

Aprašymas

Duomenų bazė (jungties pavadinimas)

DATABASE

[tekstas]

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

SQL query

SQL

[tekstas]

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

Išvestys

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

Pythono kodas

Algorithm ID: native:postgisexecutesql

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

algoritmo id rodomas, kai užvedate pelę virš algoritmo apdorojimo įrankinėje. parametrų žodynas teikia parametrų pavadinimus ir reikšmes. Daugiau informacijos apie tai, kaip vykdyti apdorojimo algoritmus Pythono konsolėje rasite skyriuje Using processing algorithms from the console.

24.1.3.6. SpatiaLite execute SQL

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

Taip pat žiūrėkite

PostgreSQL execute SQL, Execute SQL

For some SQL query examples see PostGIS SQL Query Examples.

Parametrai

Užrašas

Pavadinimas

Tipas

Aprašymas

Database layer (or file)

DATABASE

[file]

The SQLite/SpatiaLite database file to connect to

SQL query

SQL

[tekstas]

Numatytas: ‚‘

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

Išvestys

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

Pythono kodas

Algorithm ID: native:spatialiteexecutesql

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

algoritmo id rodomas, kai užvedate pelę virš algoritmo apdorojimo įrankinėje. parametrų žodynas teikia parametrų pavadinimus ir reikšmes. Daugiau informacijos apie tai, kaip vykdyti apdorojimo algoritmus Pythono konsolėje rasite skyriuje Using processing algorithms from the console.

24.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.

Taip pat žiūrėkite

PostgreSQL execute SQL, Execute SQL

For some SQL query examples see PostGIS SQL Query Examples.

Parametrai

Užrašas

Pavadinimas

Tipas

Aprašymas

Database

DATABASE

[sąrašas]

Default: not set

Select a SQLite/SpatiaLite database connected to the current session

SQL query

SQL

[tekstas]

Numatytas: ‚‘

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

Išvestys

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

Pythono kodas

Algorithm ID: native:spatialiteexecutesqlregistered

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

algoritmo id rodomas, kai užvedate pelę virš algoritmo apdorojimo įrankinėje. parametrų žodynas teikia parametrų pavadinimus ir reikšmes. Daugiau informacijos apie tai, kaip vykdyti apdorojimo algoritmus Pythono konsolėje rasite skyriuje Using processing algorithms from the console.