Reclassify raster layer
This algorithm reclassifies a raster by assigning new class values based on a class mapping.
Usage:
Start the algorithm from the Processing Toolbox panel.
Select a raster to process.
Under Class mapping note which raster values shall be reclassified by writing the original value, followed by the new value, e. g. [1:1, 2:1, 3:2 …]. In this example, classes 1 and 2 will be combined into a new class 1, while class 3 will be assigned a new value of 2.
Optionally you can define class names and visualisation under Categories as seen in the example below. Then, click run.
Parameters
- Raster layer [raster]
A raster layer to be reclassified.
- Class mapping [string]
A list of source to target class value mappings. E.g. to merge source values 1 and 2 into target value 1, and source values 3 and 4 into target value 2, use {1:1, 2:1, 3:2, 4:2}
- Categories [string]
A list of target categories in short notation: [(1, ‘Class A’, ‘#e60000’), (2, ‘Class B’, ‘#267300’)]
- No data value [number]
Value used to fill no data regions. Default: 0
Outputs
- Output classification layer [rasterDestination]
Raster file destination.
Command-line usage
>qgis_process help enmapbox:ReclassifyRasterLayer
:
----------------
Arguments
----------------
raster: Raster layer
Argument type: raster
Acceptable values:
- Path to a raster layer
mapping: Class mapping
Argument type: string
Acceptable values:
- String value
- field:FIELD_NAME to use a data defined value taken from the FIELD_NAME field
- expression:SOME EXPRESSION to use a data defined value calculated using a custom QGIS expression
categories: Categories (optional)
Argument type: string
Acceptable values:
- String value
- field:FIELD_NAME to use a data defined value taken from the FIELD_NAME field
- expression:SOME EXPRESSION to use a data defined value calculated using a custom QGIS expression
noDataValue: No data value
Default value: 0
Argument type: number
Acceptable values:
- A numeric value
- field:FIELD_NAME to use a data defined value taken from the FIELD_NAME field
- expression:SOME EXPRESSION to use a data defined value calculated using a custom QGIS expression
outputClassification: Output classification layer
Argument type: rasterDestination
Acceptable values:
- Path for new raster layer
----------------
Outputs
----------------
outputClassification: <outputRaster>
Output classification layer