23.2.3. Raster extraction¶
23.2.3.1. Clip raster by extent¶
Clips any GDAL-supported raster file to a given extent.
This algorithm is derived from the GDAL grid utility.
Default menu:
23.2.3.1.1. Parameters¶
Label |
Name |
Type |
Description |
---|---|---|---|
Input layer |
|
[raster] |
The input raster |
Clipping extent |
|
[extent] |
Extent that should be used for the output raster. Only pixels within the specified bounding box will be included in the output. |
Assign a specified nodata value to output bands Optional |
|
[number] Default: None |
Defines a value that should be inserted for the nodata values in the output raster |
Additional creation options Optional |
|
[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). |
Output data type |
|
[enumeration] Default: 0 |
Defines the format of the output raster file. Options:
|
Additional command-line parameters Optional |
|
[string] Default: None |
Add extra GDAL command line options |
Clipped (extent) |
|
[raster] Default: ‘[Save to temporary file]’ |
Specification of the output raster layer. One of:
The file encoding can also be changed here |
23.2.3.1.2. Outputs¶
Label |
Name |
Type |
Description |
---|---|---|---|
Clipped (extent) |
|
[raster] |
Output raster layer clipped by the given extent |
23.2.3.1.3. Python code¶
Algorithm ID: gdal:cliprasterbyextent
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 Using processing algorithms from the console for details on how to run processing algorithms from the Python console.
23.2.3.2. Clip raster by mask layer¶
Clips any GDAL-supported raster by a vector mask layer.
This algorithm is derived from the GDAL grid utility.
Default menu:
23.2.3.2.1. Parameters¶
Label |
Name |
Type |
Description |
---|---|---|---|
Input layer |
|
[raster] |
The input raster |
Mask layer |
|
[vector: polygon] |
Vector mask for clipping the raster |
Source CRS |
|
[crs] |
|
Target CRS |
|
[crs] |
|
Assign a specified nodata value to output bands Optional |
|
[number] Default: None |
Defines a value that should be inserted for the nodata values in the output raster |
Create an output alpha band |
|
[boolean] Default: False |
Creates an alpha band for the result. The alpha band then includes the transparency values of the pixels. |
Match the extent of the clipped raster to the extent of the mask layer |
|
[boolean] Default: True |
Applies the vector layer extent to the output raster if checked. |
Keep resolution of input raster |
|
[boolean] Default: False |
The resolution of the output raster will not be changed |
Set output file resolution |
|
[boolean] Default: False |
Shall the output resolution (cell size) be specified |
X Resolution to output bands Optional |
|
[number] Default: None |
The width of the cells in the output raster |
Y Resolution to output band Optional |
|
[number] Default: None |
The height of the cells in the output raster |
Use multithreaded warping implementation |
|
[boolean] Default: False |
|
Additional creation options Optional |
|
[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). |
Output data type |
|
[enumeration] Default: 0 |
Defines the format of the output raster file. Options:
|
Additional command-line parameters Optional |
|
[string] Default: None |
Add extra GDAL command line options |
Clipped (mask) |
|
[raster] Default: ‘[Save to temporary file]’ |
Specification of the output raster layer. One of:
The file encoding can also be changed here |
23.2.3.2.2. Outputs¶
Label |
Name |
Type |
Description |
---|---|---|---|
Clipped (mask) |
|
[raster] |
Output raster layer clipped by the vector layer |
23.2.3.2.3. Python code¶
Algorithm ID: gdal:cliprasterbymasklayer
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 Using processing algorithms from the console for details on how to run processing algorithms from the Python console.
23.2.3.3. Contour¶
Extracts contour lines from any GDAL-supported elevation raster.
This algorithm is derived from the GDAL contour utility.
Default menu:
23.2.3.3.1. Parameters¶
Label |
Name |
Type |
Description |
---|---|---|---|
Input layer |
|
[raster] |
Input raster |
Band number |
|
[raster band] |
Raster band to create the contours from |
Interval between contour lines |
|
[number] Default: 10.0 |
Defines the interval between the contour lines in the given units of the elevation raster (minimum value 0) |
Attribute name (if not set, no elevation attribute is attached) Optional |
|
[string] Default: ‘ELEV’ |
Defines the attribute name for the field containing the values of the contour lines. |
Produce 3D vector |
|
[boolean] Default: False |
Forces production of 3D vectors instead of 2D. Includes elevation at every vertex. |
Treat all raster values as valid |
|
[boolean] Default: False |
Ignores any nodata values in the dataset. |
Input pixel value to treat as “nodata” Optional |
|
[number] Default: None |
Defines a value that should be inserted for the nodata values in the output raster |
Offset from zero relative to which to interpret intervals Optional |
|
[number] Default: 0.0 |
|
Additional command-line parameters Optional |
|
[string] Default: None |
Add extra GDAL command line options |
Additional creation options Optional |
|
[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). |
Contours |
|
[vector: line] Default: ‘[Save to temporary file]’ |
Specification of the output raster layer. One of:
The file encoding can also be changed here. |
23.2.3.3.2. Outputs¶
Label |
Name |
Type |
Description |
---|---|---|---|
Contours |
|
[vector: line] |
Output vector layer with contour lines |
23.2.3.3.3. Python code¶
Algorithm ID: gdal:contour
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 Using processing algorithms from the console for details on how to run processing algorithms from the Python console.