Важно

Translation is a community effort you can join. This page is currently translated at 46.31%.

28.2.2. Конвертация растра

28.2.2.1. gdal2xyz

Преобразует растровые данные в ASCII-файл, содержащий координаты X, Y и значения ячеек

Параметры

Ярлык

Имя

Тип

Описание

Исходный слой

INPUT

[растр]

Растровый слой для конвертации

Номер канала

BAND

[канал растра]

По умолчанию: Первый по счёту канал исходного растра

Если изображение многоканальное, вы можете выбрать один канал для конвертации

Source NoData

Optional

NODATA_INPUT

[number]

Default: None

Input pixel value to treat as «NoData» (GDAL >= 3.7).

Destination NoData

Optional

NODATA_OUTPUT

[number]

Default: None

Assign specified «NoData» value to output (GDAL >= 3.7).

Do not output NoData values

SKIP_NODATA

[логическое значение]

По умолчанию: Ложь

Do not output «NoData» values (GDAL >= 3.3).

Output comma-separated values

CSV

[логическое значение]

По умолчанию: Ложь

Устанавливает, должны ли значения в выходном файле быть разделены запятыми (для соответствия формату csv)

XYZ ASCII-файл

OUTPUT

[файл]

По умолчанию: [Сохранить во временный файл]

Указание выходного файла. Одно из следующих значений:

  • Сохранить во временный файл

  • Save to File…

Результаты

Ярлык

Имя

Тип

Описание

XYZ ASCII-файл

INPUT

[таблица]

Табличный файл, содержащий значения, взятые с исходного канала растра.

Код на Python

ID алгоритма: gdal:gdal2xyz

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

ID алгоритма отображается при наведении мыши на алгоритм в Инструментах анализа. Словарь parameter dictionary содержит ключи параметров и их значения. См. Изпользование алгоритмов геообработки в консоли для детального описания того, как запускать алгоритмы анализа из консоли Python.

28.2.2.2. PCT в RGB

Преобразует 8-битное изображение с сохранённой палитрой в 24-битное RGB-изображение. Алгоритм создаст RGB-файл желаемого формата из псевдоцветного канала исходного файла.

Этот алгоритм взят из утилиты GDAL pct2rgb.

Меню по умолчанию: Растр ► Преобразование

Параметры

Ярлык

Имя

Тип

Описание

Исходный слой

INPUT

[растр]

Исходное 8-битное растровое изображение

Номер канала

BAND

[канал растра]

По умолчанию: Первый по счёту канал исходного растра

Если изображение многоканальное, вы можете выбрать один канал для конвертации

Сгенерировать файл RGBA

RGBA

[логическое значение]

По умолчанию: Ложь

Устанавливает, должен ли выходной файл содержать прозрачность

PCT в RGB

OUTPUT

[файл]

По умолчанию: [Сохранить во временный файл]

Указание выходного файла. Одно из следующих значений:

  • Сохранить во временный файл

  • Save to File…

Результаты

Ярлык

Имя

Тип

Описание

PCT в RGB

OUTPUT

[растр]

24-битное растровое изображение в формате RGB

Код на Python

ID алгоритма: gdal:pcttorgb

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

ID алгоритма отображается при наведении мыши на алгоритм в Инструментах анализа. Словарь parameter dictionary содержит ключи параметров и их значения. См. Изпользование алгоритмов геообработки в консоли для детального описания того, как запускать алгоритмы анализа из консоли Python.

28.2.2.3. Создание полигонов (растр в вектор)

Creates vector polygons for all connected regions of pixels in the raster sharing a common pixel value. Each polygon is created with an attribute indicating the pixel value of that polygon.

This algorithm is derived from the GDAL polygonize utility.

Меню по умолчанию: Растр ► Преобразование

Параметры

Basic parameters

Ярлык

Имя

Тип

Описание

Исходный слой

INPUT

[растр]

Input raster layer

Номер канала

BAND

[канал растра]

По умолчанию: Первый по счёту канал исходного растра

If the raster is multiband, choose the band you want to use

Name of the field to create

FIELD

[string]

Default: „DN“

Specify the field name for the attributes of the connected regions.

Use 8-connectedness

EIGHT_CONNECTEDNESS

[логическое значение]

По умолчанию: Ложь

If not set, raster cells must have a common border to be considered connected (4-connected). If set, touching raster cells are also considered connected (8-connected).

Vectorized

OUTPUT

[vector: polygon]

По умолчанию: [Сохранить во временный файл]

Specification of the output (polygon) vector layer. One of:

  • Сохранить во временный файл

  • Save to File…

Advanced parameters

Ярлык

Имя

Тип

Описание

Additional command-line parameters

Optional

EXTRA

[string]

Default: None

Add extra GDAL command line options

Результаты

Ярлык

Имя

Тип

Описание

Vectorized

OUTPUT

[vector: polygon]

Output vector layer

Код на Python

Algorithm ID: gdal:polygonize

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

ID алгоритма отображается при наведении мыши на алгоритм в Инструментах анализа. Словарь parameter dictionary содержит ключи параметров и их значения. См. Изпользование алгоритмов геообработки в консоли для детального описания того, как запускать алгоритмы анализа из консоли Python.

28.2.2.4. Rearrange bands

Creates a new raster using selected band(s) from a given raster layer. The algorithm also makes it possible to reorder the bands for the newly-created raster.

This algorithm is derived from the GDAL translate utility.

Параметры

Basic parameters

Ярлык

Имя

Тип

Описание

Исходный слой

INPUT

[растр]

Input raster layer

Selected band(s)

BANDS

[raster band] [list]

Default: None

Ordered list of the bands to use to create the new raster

Converted

OUTPUT

[растр]

Default: [Save to temporary file]

Specification of the output raster. One of:

  • Сохранить во временный файл

  • Save to File…

Advanced parameters

Ярлык

Имя

Тип

Описание

Additional creation options

Optional

OPTIONS

[string]

Default: „“

For adding one or more creation options that control the raster to be created (colors, block size, file compression…). For convenience, you can rely on predefined profiles (see GDAL driver options section).

Batch Process and Model Designer: separate multiple options with a pipe character (|).

Output data type

DATA_TYPE

[enumeration]

Default: 0

Defines the data type of the output raster file. Options:

  • 0 — Use Input Layer Data Type

  • 1 — Byte (Eight bit unsigned integer (quint8))

  • 2 — Int16 (Sixteen bit signed integer (qint16))

  • 3 — UInt16 (Sixteen bit unsigned integer (quint16))

  • 4 — UInt32 (Thirty two bit unsigned integer (quint32))

  • 5 — Int32 (Thirty two bit signed integer (qint32))

  • 6 — Float32 (Thirty two bit floating point (float))

  • 7 — Float64 (Sixty four bit floating point (double))

  • 8 — CInt16 (Complex Int16)

  • 9 — CInt32 (Complex Int32)

  • 10 — CFloat32 (Complex Float32)

  • 11 — CFloat64 (Complex Float64)

  • 12 — Int8 (Eight bit signed integer (qint8))

Available options depend on the GDAL version built with QGIS (see Help ► About menu)

Результаты

Ярлык

Имя

Тип

Описание

Converted

OUTPUT

[растр]

Output raster layer with rearranged bands.

Код на Python

Algorithm ID: gdal:rearrange_bands

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

ID алгоритма отображается при наведении мыши на алгоритм в Инструментах анализа. Словарь parameter dictionary содержит ключи параметров и их значения. См. Изпользование алгоритмов геообработки в консоли для детального описания того, как запускать алгоритмы анализа из консоли Python.

28.2.2.5. RGB to PCT

Converts a 24 bit RGB image into a 8 bit paletted. Computes an optimal pseudo-color table for the given RGB-image using a median cut algorithm on a downsampled RGB histogram. Then it converts the image into a pseudo-colored image using the color table. This conversion utilizes Floyd-Steinberg dithering (error diffusion) to maximize output image visual quality.

If you want to classify a raster map and want to reduce the number of classes it can be helpful to downsample your image with this algorithm before.

This algorithm is derived from the GDAL rgb2pct utility.

Меню по умолчанию: Растр ► Преобразование

Параметры

Ярлык

Имя

Тип

Описание

Исходный слой

INPUT

[растр]

Input (RGB) raster layer

Number of colors

NCOLORS

[number]

Default: 2

The number of colors the resulting image will contain. A value from 2-256 is possible.

RGB to PCT

OUTPUT

[растр]

По умолчанию: [Сохранить во временный файл]

Specification of the output raster. One of:

  • Сохранить во временный файл

  • Save to File…

Результаты

Ярлык

Имя

Тип

Описание

RGB to PCT

OUTPUT

[растр]

Output raster layer.

Код на Python

Algorithm ID: gdal:rgbtopct

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

ID алгоритма отображается при наведении мыши на алгоритм в Инструментах анализа. Словарь parameter dictionary содержит ключи параметров и их значения. См. Изпользование алгоритмов геообработки в консоли для детального описания того, как запускать алгоритмы анализа из консоли Python.

28.2.2.6. Translate (convert format)

Converts raster data between different formats.

This algorithm is derived from the GDAL translate utility.

Меню по умолчанию: Растр ► Преобразование

Параметры

Basic parameters

Ярлык

Имя

Тип

Описание

Исходный слой

INPUT

[растр]

Input raster layer

Override the projection of the output file

Optional

TARGET_CRS

[crs]

Specify a projection for the output file

Assign a specified NoData value to output bands

Optional

NODATA

[number]

Default: Not set

Defines the value to use for NoData in the output raster

Copy all subdatasets of this file to individual output files

COPY_SUBDATASETS

[логическое значение]

По умолчанию: Ложь

Create individual files for subdatasets

Converted

OUTPUT

[растр]

По умолчанию: [Сохранить во временный файл]

Specification of the output (translated) raster layer. One of:

  • Сохранить во временный файл

  • Save to File…

Advanced parameters

Ярлык

Имя

Тип

Описание

Additional creation options

Optional

OPTIONS

[string]

Default: „“

For adding one or more creation options that control the raster to be created (colors, block size, file compression…). For convenience, you can rely on predefined profiles (see GDAL driver options section).

Batch Process and Model Designer: separate multiple options with a pipe character (|).

Additional command-line parameters

Optional

EXTRA

[string]

Default: None

Add extra GDAL command line options

Output data type

DATA_TYPE

[enumeration]

Default: 0

Defines the data type of the output raster file. Options:

  • 0 — Use Input Layer Data Type

  • 1 — Byte (Eight bit unsigned integer (quint8))

  • 2 — Int16 (Sixteen bit signed integer (qint16))

  • 3 — UInt16 (Sixteen bit unsigned integer (quint16))

  • 4 — UInt32 (Thirty two bit unsigned integer (quint32))

  • 5 — Int32 (Thirty two bit signed integer (qint32))

  • 6 — Float32 (Thirty two bit floating point (float))

  • 7 — Float64 (Sixty four bit floating point (double))

  • 8 — CInt16 (Complex Int16)

  • 9 — CInt32 (Complex Int32)

  • 10 — CFloat32 (Complex Float32)

  • 11 — CFloat64 (Complex Float64)

  • 12 — Int8 (Eight bit signed integer (qint8))

Available options depend on the GDAL version built with QGIS (see Help ► About menu)

Результаты

Ярлык

Имя

Тип

Описание

Converted

OUTPUT

[растр]

Output (translated) raster layer.

Код на Python

Algorithm ID: gdal:translate

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

ID алгоритма отображается при наведении мыши на алгоритм в Инструментах анализа. Словарь parameter dictionary содержит ключи параметров и их значения. См. Изпользование алгоритмов геообработки в консоли для детального описания того, как запускать алгоритмы анализа из консоли Python.