23.1.9. Análisis raster

23.1.9.1. Raster boolean AND

Calculates the boolean AND for a set of input rasters. If all of the input rasters have a non-zero value for a pixel, that pixel will be set to 1 in the output raster. If any of the input rasters have 0 values for the pixel it will be set to 0 in the output raster.

The reference layer parameter specifies an existing raster layer to use as a reference when creating the output raster. The output raster will have the same extent, CRS, and pixel dimensions as this layer.

By default, a nodata pixel in ANY of the input layers will result in a nodata pixel in the output raster. If the Treat nodata values as false option is checked, then nodata inputs will be treated the same as a 0 input value.

Ver también

Raster boolean OR

23.1.9.1.1. Parametros

Etiqueta

Nombre

Tipo

Descripción

Input layers

ENTRADA

[raster] [list]

List of input raster layers

Capa de referencia

REF_LAYER

[raster]

The reference layer to create the output layer from (extent, CRS, pixel dimensions)

Treat nodata values as false

NODATA_AS_FALSE

[boolean]

Preestablecido: Falso

Treat nodata values in the input files as 0 when performing the operation

Output no data value

NO_DATA

[número]

Default: -9999.0

Value to use for nodata in the output layer

Output data type

DATA_TYPE

[enumeración]

Predeterminado: 5

Output raster data type. Options:

  • 0 — Byte

  • 1 — Int16

  • 2 — UInt16

  • 3 — UInt32

  • 4 — Int32

  • 5 — Float32

  • 6 — Float64

  • 7 — CInt16

  • 8 — CInt32

  • 9 — CFloat32

  • 10 — CFloat64

Output layer

SALIDA

[raster]

Output raster layer

23.1.9.1.2. Salidas

Etiqueta

Nombre

Tipo

Descripción

Extensión

EXTENT

[extent]

The extent of the output raster layer

CRS authority identifier

CRS_AUTHID

[crs]

The coordinate reference system of the output raster layer

Width in pixels

WIDTH_IN_PIXELS

[integer]

The width in pixels of the output raster layer

Height in pixels

HEIGHT_IN_PIXELS

[integer]

The height in pixels of the output raster layer

Total pixel count

TOTAL_PIXEL_COUNT

[integer]

The count of pixels in the output raster layer

NODATA pixel count

NODATA_PIXEL_COUNT

[integer]

The count of nodata pixels in the output raster layer

True pixel count

TRUE_PIXEL_COUNT

[integer]

The count of True pixels (value = 1) in the output raster layer

False pixel count

FALSE_PIXEL_COUNT

[integer]

The count of False pixels (value = 0) in the output raster layer

Output layer

SALIDA

[raster]

Output raster layer containing the result

23.1.9.1.3. Python code

Algorithm ID: qgis:rasterbooleanand

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 Utilizar algoritmos de procesamiento desde la consola for details on how to run processing algorithms from the Python console.

23.1.9.2. Raster boolean OR

Calculates the boolean OR for a set of input rasters. If all of the input rasters have a zero value for a pixel, that pixel will be set to 0 in the output raster. If any of the input rasters have 1 values for the pixel it will be set to 1 in the output raster.

The reference layer parameter specifies an existing raster layer to use as a reference when creating the output raster. The output raster will have the same extent, CRS, and pixel dimensions as this layer.

By default, a nodata pixel in ANY of the input layers will result in a nodata pixel in the output raster. If the Treat nodata values as false option is checked, then nodata inputs will be treated the same as a 0 input value.

Ver también

Raster boolean AND

23.1.9.2.1. Parametros

Etiqueta

Nombre

Tipo

Descripción

Input layers

ENTRADA

[raster] [list]

List of input raster layers

Capa de referencia

REF_LAYER

[raster]

The reference layer to create the output layer from (extent, CRS, pixel dimensions)

Treat nodata values as false

NODATA_AS_FALSE

[boolean]

Preestablecido: Falso

Treat nodata values in the input files as 0 when performing the operation

Output no data value

NO_DATA

[número]

Default: -9999.0

Value to use for nodata in the output layer

Output data type

DATA_TYPE

[enumeración]

Predeterminado: 5

Output raster data type. Options:

  • 0 — Byte

  • 1 — Int16

  • 2 — UInt16

  • 3 — UInt32

  • 4 — Int32

  • 5 — Float32

  • 6 — Float64

  • 7 — CInt16

  • 8 — CInt32

  • 9 — CFloat32

  • 10 — CFloat64

Output layer

SALIDA

[raster]

Output raster layer

23.1.9.2.2. Salidas

Etiqueta

Nombre

Tipo

Descripción

Extensión

EXTENT

[extent]

The extent of the output raster layer

CRS authority identifier

CRS_AUTHID

[crs]

The coordinate reference system of the output raster layer

Width in pixels

WIDTH_IN_PIXELS

[integer]

The width in pixels of the output raster layer

Height in pixels

HEIGHT_IN_PIXELS

[integer]

The height in pixels of the output raster layer

Total pixel count

TOTAL_PIXEL_COUNT

[integer]

The count of pixels in the output raster layer

NODATA pixel count

NODATA_PIXEL_COUNT

[integer]

The count of nodata pixels in the output raster layer

True pixel count

TRUE_PIXEL_COUNT

[integer]

The count of True pixels (value = 1) in the output raster layer

False pixel count

FALSE_PIXEL_COUNT

[integer]

The count of False pixels (value = 0) in the output raster layer

Output layer

SALIDA

[raster]

Output raster layer containing the result

23.1.9.2.3. Python code

Algorithm ID: qgis:rasterbooleanor

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 Utilizar algoritmos de procesamiento desde la consola for details on how to run processing algorithms from the Python console.

23.1.9.3. Raster calculator

Performs algebraic operations using raster layers.

The resulting layer will have its values computed according to an expression. The expression can contain numerical values, operators and references to any of the layers in the current project.

Nota

When using the calculator in La interfaz de procesamiento por lotes or from the Consola Python de QGIS the files to use have to be specified. The corresponding layers are referred using the base name of the file (without the full path). For instance, if using a layer at path/to/my/rasterfile.tif, the first band of that layer will be referred as rasterfile.tif@1.

23.1.9.3.1. Parametros

Etiqueta

Nombre

Tipo

Descripción

Layers

Solo GUI

Shows the list of all raster layers loaded in the legend. These can be used to fill the expression box (double click to add). Raster layers are referred by their name and the number of the band: layer_name@band_number. For instance, the first band from a layer named DEM will be referred as DEM@1.

Operators

Solo GUI

Contains some calculator like buttons that can be used to fill the expression box.

Expression

EXPRESION

[string]

Expression that will be used to calculate the output raster layer. You can use the operator buttons provided to type directly the expression in this box.

Predefined expressions

Solo GUI

You can use the predefined NDVI expression or you can define new expressions for calculations. The Add… button loads a defined expression (and lets you set the parameters). The Save… button lets you define a new expression.

Reference layer(s) (used for automated extent, cellsize, and CRS)

Opcional

LAYERS

[raster] [list]

Layer(s) that will be used to fetch extent, cell size and CRS. By choosing the layer in this box you avoid filling in all the other parameters by hand. Raster layers are referred by their name and the number of the band: layer_name@band_number. For instance, the first band from a layer named DEM will be referred as DEM@1.

Cell size (use 0 or empty to set it automatically)

Opcional

CELLSIZE

[número]

Cell size of the output raster layer. If the cell size is not specified, the minimum cell size of the selected reference layer(s) will be used. The cell size will be the same for the X and Y axes.

Output extent (xmin, xmax, ymin, ymax)

EXTENT

[extent]

Extent of the output raster layer. If the extent is not specified, the minimum extent that covers all the selected reference layers will be used.

CRS saliente

Opcional

CRS

[crs]

CRS of the output raster layer. If the output CRS is not specified, the CRS of the first reference layer will be used.

Salida

SALIDA

[raster]

Predeterminado: [Save to temporary file]

Specification of the output raster. One of:

  • Guardar a un Archivo Temporal

  • Guardar a Fichero…

El fichero codificado también puede ser cambiado aquí.

23.1.9.3.2. Salidas

Etiqueta

Nombre

Tipo

Descripción

Salida

SALIDA

[raster]

Output raster file with the calculated values.

23.1.9.3.3. Python code

Algorithm ID: qgis:rastercalculator

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 Utilizar algoritmos de procesamiento desde la consola for details on how to run processing algorithms from the Python console.

23.1.9.4. Raster layer statistics

Calculates basic statistics from the values in a given band of the raster layer. The output is loaded in the Processing ‣ Results viewer menu.

23.1.9.4.1. Parametros

Etiqueta

Nombre

Tipo

Descripción

Capa de entrada

ENTRADA

[raster]

Input raster layer

Número de banda

BANDA

[banda ráster]

Default: The first band of the input layer

If the raster is multiband, choose the band you want to get statistics for.

Salida

OUTPUT_HTML_FILE

[html]

Predeterminado: [Save to temporary file]

Specification of the output file:

  • Saltar salida

  • Guardar a un Archivo Temporal

  • Guardar a Fichero…

El fichero codificado también puede ser cambiado aquí.

23.1.9.4.2. Salidas

Etiqueta

Nombre

Tipo

Descripción

Maximum value

MAX

[número]

Mean value

MEAN

[número]

Minimum value

MIN

[número]

Salida

OUTPUT_HTML_FILE

[html]

The output file contains the following information:

  • Analyzed file: path of the raster layer

  • Minimum value: minimum value of the raster

  • Maximum value: maximum value of the raster

  • Range: difference between the maximum and minimum values

  • Sum: total sum of the values

  • Mean value: mean of the values

  • Standard deviation: standard deviation of the values

  • Sum of the squares: sum of the squared differences of each observation from the overall mean

Range

RANGE

[número]

Standard deviation

STD_DEV

[número]

Sum

SUM

[número]

Sum of the squares

SUM_OF_SQUARES

[número]

23.1.9.4.3. Python code

Algorithm ID: qgis:rasterlayerstatistics

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 Utilizar algoritmos de procesamiento desde la consola for details on how to run processing algorithms from the Python console.

23.1.9.5. Raster layer unique values report

Returns the count and area of each unique value in a given raster layer.

23.1.9.5.1. Parametros

Etiqueta

Nombre

Tipo

Descripción

Capa de entrada

ENTRADA

[raster]

Input raster layer

Número de banda

BANDA

[banda ráster]

Default: The first band of the input layer

If the raster is multiband, choose the band you want to get statistics for.

Unique values report

OUTPUT_HTML_FILE

[file]

Predeterminado: [Save to temporary file]

Specification of the output file:

  • Saltar salida

  • Guardar a un Archivo Temporal

  • Guardar a Fichero…

El fichero codificado también puede ser cambiado aquí.

Unique values table

OUTPUT_TABLE

[table]

Preestablecido: [Saltar salida]

Specification of the table for unique values:

  • Saltar salida

  • Create Temporary Layer

  • Guardar a Fichero…

  • Save to GeoPackage…

  • Save to PostGIS Table……

El fichero codificado también puede ser cambiado aquí.

23.1.9.5.2. Salidas

Etiqueta

Nombre

Tipo

Descripción

CRS authority identifier

CRS_AUTHID

[crs]

Extensión

EXTENT

[extent]

Height in pixels

HEIGHT_IN_PIXELS

[número]

NODATA pixel count

NODATA_PIXEL_COUNT

[número]

Total pixel count

TOTAL_PIXEL_COUNT

[número]

Unique values report

OUTPUT_HTML_FILE

[html]

The output HTML file contains the following information:

  • Analyzed file: the path of the raster layer

  • Extent: xmin, ymin, xmax, ymax coordinates of the extent

  • Projection: projection of the layer

  • Width in pixels: number of columns and pixel width size

  • Height in pixels: number of rows and pixel width size

  • Total pixel count: count of all the pixels

  • NODATA pixel count: count of pixels with NODATA value

Unique values table

OUTPUT_TABLE

[table]

A table with three columns:

  • value: pixel value

  • count: count of pixels with this value

  • m2: total area in square meters of pixels with this value.

Width in pixels

WIDTH_IN_PIXELS

[número]

23.1.9.5.3. Python code

Algorithm ID: qgis:rasterlayeruniquevaluesreport

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 Utilizar algoritmos de procesamiento desde la consola for details on how to run processing algorithms from the Python console.

23.1.9.6. Raster layer zonal statistics

Calculates statistics for a raster layer’s values, categorized by zones defined in another raster layer.

Ver también

Zonal statistics

23.1.9.6.1. Parametros

Etiqueta

Nombre

Tipo

Descripción

Capa Entrante

ENTRADA

[raster]

Input raster layer

Número de banda

BANDA

[banda ráster]

Default: The first band of the raster layer

If the raster is multiband choose the band for which you want to calculate the statistics.

Zones layer

ZONES

[raster]

Raster layer defining zones. Zones are given by contiguous pixels having the same pixel value.

Zones band number

ZONES_BAND

[banda ráster]

Default: The first band of the raster layer

If the raster is multiband, choose the band that defines the zones

Capa de referencia

Opcional

REF_LAYER

[enumeración]

Predeterminado: 0

Raster layer used to calculate the centroids that will be used as reference when determining the zones in the output layer. One of:

  • 0 — Input layer

  • 1 — Zones layer

Statistics

OUTPUT_TABLE

[table]

Table with the calculated statistics

23.1.9.6.2. Salidas

Etiqueta

Nombre

Tipo

Descripción

CRS authority identifier

CRS_AUTHID

[crs]

Extensión

EXTENT

[extent]

Height in pixels

HEIGHT_IN_PIXELS

[número]

NODATA pixel count

NODATA_PIXEL_COUNT

[número]

Statistics

OUTPUT_TABLE

[table]

The output layer contains the following information for each zone:

  • Area: the area in square raster units in the zone;

  • Sum: the total sum of the pixel values in the zone;

  • Count: the number of pixels in the zone;

  • Min: the minimum pixel value in the zone;

  • Max: the maximum pixel value in the zone;

  • Mean: the mean of the pixel values in the zone;

Total pixel count

TOTAL_PIXEL_COUNT

[número]

Width in pixels

WIDTH_IN_PIXELS

[número]

23.1.9.6.3. Python code

Algorithm ID: qgis:rasterlayerzonalstats

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 Utilizar algoritmos de procesamiento desde la consola for details on how to run processing algorithms from the Python console.

23.1.9.7. Raster surface volume

Calculates the volume under a raster surface relative to a given base level. This is mainly useful for Digital Elevation Models (DEM).

23.1.9.7.1. Parametros

Etiqueta

Nombre

Tipo

Descripción

INPUT layer

ENTRADA

[raster]

Input raster, representing a surface

Número de banda

BANDA

[banda ráster]

Default: The first band of the raster layer

If the raster is multiband, choose the band that shall define the surface.

Base level

LEVEL

[número]

Preestablecido: 0.0

Define a base or reference value. This base is used in the volume calculation according to the Method parameter (see below).

Methodo

METHODO

[enumeración]

Predeterminado: 0

Define the method for the volume calculation given by the difference between the raster pixel value and the Base level. Options:

  • 0 — Count Only Above Base Level: only pixels above the base level will add to the volume.

  • 1 — Count Only Below Base Level: only pixels below the base level will add to the volume.

  • 2 — Subtract Volumes Below Base level: pixels above the base level will add to the volume, pixels below the base level will subtract from the volume.

  • 3 — Add Volumes Below Base level: Add the volume regardless whether the pixel is above or below the base level. This is equivalent to sum the absolute values of the difference between the pixel value and the base level.

Surface volume report

OUTPUT_HTML_FILE

[html]

Predeterminado: [Save to temporary file]

Specification of the output HTML report. One of:

  • Saltar salida

  • Save to Temporary File

  • Guardar a Fichero…

El fichero codificado también puede ser cambiado aquí.

Surface volume table

OUTPUT_TABLE

[table]

Preestablecido: [Saltar salida]

Specification of the output table. One of:

  • Saltar salida

  • Crear capa temporal (SALIDA_TEMPORAL)

  • Guardar a Fichero…

  • Guardar a Geopackage…

  • Guardar a Tabla PostGIS…

El fichero codificado también puede ser cambiado aquí.

23.1.9.7.2. Salidas

Etiqueta

Nombre

Tipo

Descripción

Volume

VOLUME

[número]

The calculated volume

Area

AREA

[número]

The area in square map units

Pixel_count

PIXEL_COUNT

[número]

The total number of pixels that have been analyzed

Surface volume report

OUTPUT_HTML_FILE

[html]

The output report (containing volume, area and pixel count) in HTML format

Surface volume table

OUTPUT_TABLE

[table]

The output table (containing volume, area and pixel count)

23.1.9.7.3. Python code

Algorithm ID: qgis:rastersurfacevolume

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 Utilizar algoritmos de procesamiento desde la consola for details on how to run processing algorithms from the Python console.

23.1.9.8. Reclassify by layer

Reclassifies a raster band by assigning new class values based on the ranges specified in a vector table.

23.1.9.8.1. Parametros

Etiqueta

Nombre

Tipo

Descripción

Capa ráster

INPUT_RASTER

[raster]

Raster layer to reclassify

Número de banda

RASTER_BAND

[banda ráster]

Default: The first band of the raster layer

If the raster is multiband, choose the band you want to reclassify.

Layer containing class breaks

INPUT_TABLE

[vector: cualquiera]

Vector layer containing the values to use for classification.

Minimum class value field

MIN_FIELD

[tablefield: numeric]

Field with the minimum value of the range for the class.

Maximum class value field

MAX_FIELD

[tablefield: numeric]

Field with the maximum value of the range for the class.

Output value field

VALUE_FIELD

[tablefield: numeric]

Field with the value that will be assigned to the pixels that fall in the class (between the corresponding min and max values).

Output no data value

NO_DATA

[número]

Default: -9999.0

Value to apply to no data values.

Range boundaries

RANGE_BOUNDARIES

[enumeración]

Predeterminado: 0

Defines comparison rules for the classification. Options:

  • 0 — min < value <= max

  • 1 — min <= value < max

  • 2 — min <= value <= max

  • 3 — min < value < max

Use no data when no range matches value

NODATA_FOR_MISSING

[boolean]

Preestablecido: Falso

Values that do not belong to a class will result in the no data value. If False, the original value is kept.

Output data type

DATA_TYPE

[enumeración]

Predeterminado: 5

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

  • 0 — Byte

  • 1 — Int16

  • 2 — UInt16

  • 3 — UInt32

  • 4 — Int32

  • 5 — Float32

  • 6 — Float64

  • 7 — CInt16

  • 8 — CInt32

  • 9 — CFloat32

  • 10 — CFloat64

Reclassified raster

SALIDA

[raster]

Specification of the output raster. One of:

  • Guardar a un Archivo Temporal

  • Guardar a Fichero…

El fichero codificado también puede ser cambiado aquí.

23.1.9.8.2. Salidas

Etiqueta

Nombre

Tipo

Descripción

Reclassified raster

SALIDA

[raster]

Output raster layer with reclassified band values

23.1.9.8.3. Python code

Algorithm ID: qgis:reclassifybylayer

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 Utilizar algoritmos de procesamiento desde la consola for details on how to run processing algorithms from the Python console.

23.1.9.9. Reclassify by table

Reclassifies a raster band by assigning new class values based on the ranges specified in a fixed table.

23.1.9.9.1. Parametros

Etiqueta

Nombre

Tipo

Descripción

Capa ráster

INPUT_RASTER

[raster]

Raster layer to reclassify

Número de banda

RASTER_BAND

[banda ráster]

Preestablecido: 1

Raster band for which you want to recalculate values.

Reclassification table

TABLE

[table]

A 3-columns table to fill with the values to set the boundaries of each class (Minimum and Maximum) and the new Value to assign to the band values that fall in the class.

Output no data value

NO_DATA

[número]

Default: -9999.0

Value to apply to no data values.

Range boundaries

RANGE_BOUNDARIES

[enumeración]

Predeterminado: 0

Defines comparison rules for the classification. Options:

  • 0 — min < value <= max

  • 1 — min <= value < max

  • 2 — min <= value <= max

  • 3 — min < value < max

Use no data when no range matches value

NODATA_FOR_MISSING

[boolean]

Preestablecido: Falso

Applies the no data value to band values that do not fall in any class. If False, the original value is kept.

Output data type

DATA_TYPE

[enumeración]

Predeterminado: 5

Defines the format of the output raster file.

Opciones:

  • 0 — Byte

  • 1 — Int16

  • 2 — UInt16

  • 3 — UInt32

  • 4 — Int32

  • 5 — Float32

  • 6 — Float64

  • 7 — CInt16

  • 8 — CInt32

  • 9 — CFloat32

  • 10 — CFloat64

Reclassified raster

SALIDA

[raster]

Default: “[Save to temporary file]”

Specification of the output raster layer. One of:

  • Guardar a un Archivo Temporal

  • Guardar a Fichero…

The file encoding can also be changed here

23.1.9.9.2. Salidas

Etiqueta

Nombre

Tipo

Descripción

Reclassified raster

SALIDA

[raster]

Default: “[Save to temporary file]”

The output raster layer.

23.1.9.9.3. Python code

Algorithm ID: qgis:reclassifybytable

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 Utilizar algoritmos de procesamiento desde la consola for details on how to run processing algorithms from the Python console.

23.1.9.10. Sample raster values

Extracts raster values at the point locations. If the raster layer is multiband, each band is sampled.

The attribute table of the resulting layer will have as many new columns as the raster layer band count.

23.1.9.10.1. Parametros

Etiqueta

Nombre

Tipo

Descripción

Input Point Layer

ENTRADA

[vector: point]

Point vector layer to use for sampling

Raster Layer to sample

RASTERCOPY

[raster]

Raster layer to sample at the given point locations.

Prefijo de columna saliente

PREFIJO_DE_COLUMNA

[string]

Default: “rvalue”

Prefix for the names of the added columns.

Sampled Points

(Opcional)

SALIDA

[vector: point]

Predeterminado: [Crear capa temporal]

Specify the output layer containing the sampled values. One of:

  • Crear capa temporal (SALIDA_TEMPORAL)

  • Guardar a Fichero…

  • Save to GeoPackage…

  • Guardar a Tabla PostGIS…

El fichero codificado también puede ser cambiado aquí.

23.1.9.10.2. Salidas

Etiqueta

Nombre

Tipo

Descripción

Sampled Points

(Opcional)

SALIDA

[vector: point]

The output layer containing the sampled values.

23.1.9.10.3. Python code

Algorithm ID: qgis:rastersampling

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 Utilizar algoritmos de procesamiento desde la consola for details on how to run processing algorithms from the Python console.

23.1.9.11. Zonal histogram

Appends fields representing counts of each unique value from a raster layer contained within polygon features.

The output layer attribute table will have as many fields as the unique values of the raster layer that intersects the polygon(s).

../../../../_images/raster_histogram.png

Figura 23.7 Raster layer histogram example

23.1.9.11.1. Parametros

Etiqueta

Nombre

Tipo

Descripción

Capa ráster

INPUT_RASTER

[raster]

Input raster layer.

Número de banda

RASTER_BAND

[banda ráster]

Default: The first band of the input layer

If the raster is multiband, choose a band.

Vector layer containing zones

INPUT_VECTOR

[vector: polígono]

Vector polygon layer that defines the zones.

Prefijo de columna saliente

PREFIJO_DE_COLUMNA

Opcional

[string]

Default: “HISTO_”

Prefix for the output columns names.

Output zones

SALIDA

[vector: polígono]

Predeterminado: [Crear capa temporal]

Specify the output vector polygon layer. One of:

  • Crear capa temporal (SALIDA_TEMPORAL)

  • Guardar a Fichero…

  • Save to GeoPackage…

  • Guardar a Tabla PostGIS…

El fichero codificado también puede ser cambiado aquí.

23.1.9.11.2. Salidas

Etiqueta

Nombre

Tipo

Descripción

Output zones

(Opcional)

SALIDA

[vector: polígono]

Predeterminado: [Crear capa temporal]

The output vector polygon layer.

23.1.9.11.3. Python code

Algorithm ID: qgis:zonalhistogram

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 Utilizar algoritmos de procesamiento desde la consola for details on how to run processing algorithms from the Python console.

23.1.9.12. Zonal statistics

Calculates statistics of a raster layer for each feature of an overlapping polygon vector layer.

Advertencia

No new output file will be created. The algorithm adds new columns to the source vector layer.

23.1.9.12.1. Parametros

Etiqueta

Nombre

Tipo

Descripción

Capa ráster

INPUT_RASTER

[raster]

Input raster layer.

Raster band

RASTER_BAND

[banda ráster]

Default: The first band of the input layer

If the raster is multiband, choose a band for the statistics.

Vector layer containing zones

INPUT_VECTOR

[vector: polígono]

Vector polygon layer that defines the zones.

Prefijo de columna saliente

PREFIJO_DE_COLUMNA

[string]

Default: “_”

Prefix for the output columns names.

Statistics to calculate

STATISTICS

[enumeration] [list]

Default: [0,1,2]

List of statistical operator for the output. Options:

  • 0 — Count

  • 1 — Sum

  • 2 — Mean

  • 3 — Median

  • 4 — St. dev.

  • 5 — Minimum

  • 6 — Maximum

  • 7 — Range

  • 8 — Minority

  • 9 — Majority

  • 10 — Variety

  • 11 — Variance

23.1.9.12.2. Salidas

Etiqueta

Nombre

Tipo

Descripción

Vector layer containing zones

INPUT_VECTOR

[vector: polígono]

The input zone vector layer with added statistics.

23.1.9.12.3. Python code

Algorithm ID: qgis:zonalstatistics

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 Utilizar algoritmos de procesamiento desde la consola for details on how to run processing algorithms from the Python console.