Sample raster layer values

Creates a new point layer with the same attributes of the input layer and the raster values corresponding to the pixels covered by polygons or point location. The resulting point vector contains 1) all input attributes from the Locations vector, 2) attributes SAMPLE_{i}, one for each input raster band, 3) two attributes PIXEL_X, PIXEL_Y for storing the raster pixel locations (zero-based),and 4), in case of polygon locations, an attribute COVER for storing the pixel coverage (%). Note that we assume non-overlapping feature geometries! In case of overlapping geometries, split the Locations layer into non-overlapping subsets, perform the sampling for each subset individually, and finally concatenate the results.

Usage:

  1. Open the algorithm from the processing toolbox.

  2. Select a raster layer and a vector layer defining your sampling points, then click run.

    ../../../../_images/sample_raster_values.png

Parameters

Raster layer [raster]

A raster layer to sample data from.

Vector layer [vector]

A vector layer defining the locations to sample.

Skip no data pixel [boolean]

Whether to skip pixels from no data regions.

Default: False

Pixel coverage (%) [range]

Samples with polygon pixel coverage outside the given range are excluded. This parameter has no effect in case of point locations.

Default: [50, 100]

Outputs

Output point layer [vectorDestination]

Vector file destination.

Command-line usage

>qgis_process help enmapbox:SampleRasterLayerValues:

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

raster: Raster layer
    Argument type:  raster
    Acceptable values:
            - Path to a raster layer
vector: Vector layer
    Argument type:  vector
    Acceptable values:
            - Path to a vector layer
skipNoDataPixel: Skip no data pixel (optional)
    Default value:  false
    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
coverageRange: Pixel coverage (%) (optional)
    Default value:
    Argument type:  range
    Acceptable values:
            - Two comma separated numeric values, e.g. '1,10'
outputPointsData: Output point layer
    Argument type:  vectorDestination
    Acceptable values:
            - Path for new vector layer

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

outputPointsData: <outputVector>
    Output point layer