Create classification dataset (from categorized raster layer and feature raster)

Create a classification dataset by sampling data for pixels that match the given categories and store the result as a pickle file. If the layer is not categorized, or the band with class values is selected manually, categories are derived from sampled data itself. To be more precise: i) category values are derived from unique raster band values (after excluding no data or zero data pixel), ii) category names are set equal to the category values, and iii) category colors are picked randomly.

Usage:

  1. Open the algorithm from the processing toolbox.

  2. Select a categorized raster layer containing your classes as well as a raster layer containing your features, e. g. a satellite image, then click run.

    ../../../../_images/classraster.png
  3. The output classification dataset will be listed under Models in your Data Sources panel.

Parameters

Categorized raster layer [raster]

Categorized raster layer specifying sample locations and target data y. If required, the layer is reprojected and resampled internally to match the feature raster grid.

Raster layer with features [raster]

Raster layer used for sampling feature data X.

Exclude bad bands [boolean]

Whether to exclude bands, that are marked as bad bands, or contain no data, inf or nan values in all samples.

Default: True

Band with class values [band]

Band with class values. If not selected, the band defined by the renderer is used. If that is also not specified, the first band is used.

Outputs

Output dataset [fileDestination]

Pickle file destination.

Command-line usage

>qgis_process help enmapbox:CreateClassificationDatasetFromCategorizedRasterLayerAndFeatureRaster:

----------------
Arguments
----------------

categorizedRaster: Categorized raster layer
    Argument type:  raster
    Acceptable values:
            - Path to a raster layer
featureRaster: Raster layer with features
    Argument type:  raster
    Acceptable values:
            - Path to a raster layer
excludeBadBands: Exclude bad bands (optional)
    Default value:  true
    Argument type:  boolean
    Acceptable values:
            - 1 for true/yes
            - 0 for false/no
            - 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
categoryBand: Band with class values (optional)
    Argument type:  band
    Acceptable values:
            - Integer value representing an existing raster band number
outputClassificationDataset: Output dataset
    Argument type:  fileDestination
    Acceptable values:
            - Path for new file

----------------
Outputs
----------------

outputClassificationDataset: <outputFile>
    Output dataset