pkextractimg(1) extract pixel values from raster image using a raster sample


pkextractimg -i input [-s sample] -o output [options]


pkextractimg extracts pixel values from an input raster dataset, based on the locations you provide via a sample file. The sample should be a raster dataset with categorical (integer) values. The typical use case is a land cover map that overlaps the input raster dataset. The utility then extracts pixels from the input raster for the respective land cover classes. To select a random subset of the sample raster dataset you can set the threshold option -t with a percentage value. You can provide a threshold value for each class (e.g. -t 80 -t 60). Use value 100 to select all pixels for selected class(es). As output, a new copy of the vector file is created with an extra attribute for the extracted pixel value. For each raster band in the input image, a separate attribute is created. For instance, if the raster dataset contains three bands, three attributes are created (b0, b1 and b2).


-i filename, --input filename
Raster input dataset containing band information
-s sample, --sample sample
Raster dataset with categorical values to sample the input raster dataset. Output will contain features with input band information included.
-ln layer, --ln layer
Layer name(s) in sample (leave empty to select all)
-rand number, --random number
Create simple random sample of points. Provide number of points to generate
-grid size, --grid size
Create systematic grid of points. Provide cell grid size (in projected units, e.g,. m)
-o filename, --output filename
Output sample dataset
-c class, --class class
Class(es) to extract from input sample image. Leave empty to extract all valid data pixels from sample dataset. Make sure to set classes if rule is set to mode, proportion or count.
-t threshold, --threshold threshold
Probability threshold for selecting samples (randomly). Provide probability in percentage (>0) or absolute (<0). Use a single threshold per vector sample layer. If using raster land cover maps as a sample dataset, you can provide a threshold value for each class (e.g. -t 80 -t 60). Use value 100 to select all pixels for selected class(es)
-f format, --f format
Output sample dataset format
-ft fieldType, --ftype fieldType
Field type (only Real or Integer)
-lt labelType, --ltype labelType
Label type: In16 or String
-b band, --band band
Band index(es) to extract. Leave empty to use all bands
-sband band, --startband band
Start band sequence number
-eband band, --endband band
End band sequence number
-bndnodata band, --bndnodata band
Band(s) in input image to check if pixel is valid (used for srcnodata)
-srcnodata value, --srcnodata value
Invalid value(s) for input image
-bn attribute, --bname attribute
For single band input data, this extra attribute name will correspond to the raster values. For multi-band input data, multiple attributes with this prefix will be added (e.g. b0, b1, b2, etc.)
-cn attribute, --cname attribute
Name of the class label in the output vector dataset
-down value, --down value
Down sampling factor
-v level, --verbose level
Verbose mode if > 0