Reference

pkextractogr(1)

extract pixel values from raster image from a (vector or raster) sample

NAME

pkextractogr - extract pixel values from raster image from a (vector or raster) sample

SYNOPSIS

FCpkextractogrF[0] FC-iF[0] input [FC-sF[0] sample | FC-randF[0] number | FC-gridF[0] size] FC-oF[0] output [options]

DESCRIPTION

pkextractogr extracts pixel values from an input raster dataset, based on the locations you provide via a sample file. Alternatively, a random sample or systematic grid of points can also be extracted. The sample can be a vector file with points or polygons. In the case of polygons, you can either extract the values for all raster pixels that are covered by the polygons, or extract a single value for each polygon such as the centroid, mean, median, etc. 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).

A typical usage of pkextractogr is to prepare a training sample for one of the classifiers implemented in pktools.

Overview of the possible extraction rules:

Extraction ruleOutput features
pointExtract all pixel values covered by the polygon (option FC-polygonF[0] not set) or extract a pixel on the surface option (FC-polygonF[0] set).
allpointsExtract all pixel values covered by the polygon.
centroidExtract pixel value at the centroid of the polygon.
meanExtract average of all pixel values within the polygon.
stdevExtract standard deviation of all pixel values within the polygon.
medianExtract median of all pixel values within the polygon.
minExtract minimum value of all pixels within the polygon.
maxExtract maximum value of all pixels within the polygon.
sumExtract sum of the values of all pixels within the polygon.
modeExtract the mode of classes within the polygon (classes must be set with the option class).
proportionExtract proportion of class(es) within the polygon (classes must be set with the option class).
countExtract count of class(es) within the polygon (classes must be set with the option class).
percentileExtract percentile as defined by option perc (e.g, 95th percentile of values covered by polygon).

OPTIONS

FC-iF[0] filename, FC--inputF[0] filename

Raster input dataset containing band information

FC-sF[0] sample, FC--sampleF[0] sample

OGR vector dataset with features to be extracted from input data. Output will contain features with input band information included. Sample image can also be GDAL raster dataset.

FC-lnF[0] layer, FC--lnF[0] layer

Layer name(s) in sample (leave empty to select all)

FC-randF[0] number, FC--randomF[0] number

Create simple random sample of points. Provide number of points to generate

FC-gridF[0] size, FC--gridF[0] size

Create systematic grid of points. Provide cell grid size (in projected units, e.g,. m)

FC-oF[0] filename, FC--outputF[0] filename

Output sample dataset Output sample dataset

FC-cF[0] class, FC--classF[0] 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.

FC-tF[0] threshold, FC--thresholdF[0] 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. FC-tF[0] 80 FC-tF[0] 60). Use value 100 to select all pixels for selected class(es)

FC-percF[0] percentile, FC--percF[0] percentile

Percentile value used for rule percentile

FC-fF[0] format, FC--fF[0] format

Output sample dataset format

FC-ftF[0] fieldType, FC--ftypeF[0] fieldType

Field type (only Real or Integer)

FC-ltF[0] labelType, FC--ltypeF[0] labelType

Label type: In16 or String

FC-bF[0] band, FC--bandF[0] band

Band index(es) to extract. Leave empty to use all bands

FC-sbandF[0] band, FC--startbandF[0] band

Start band sequence number

FC-ebandF[0] band, FC--endbandF[0] band

End band sequence number

FC-rF[0] rule, FC--ruleF[0] rule

Rule how to report image information per feature (only for vector sample). point (value at each point or at centroid if polygon), centroid, mean, stdev, median, proportion, count, min, max, mode, sum, percentile.

FC-bndnodataF[0] band, FC--bndnodataF[0] band

Band(s) in input image to check if pixel is valid (used for srcnodata)

FC-srcnodataF[0] value, FC--srcnodataF[0] value

Invalid value(s) for input image

FC-tpF[0] threshold, FC--thresholdPolygonF[0] threshold

(absolute) threshold for selecting samples in each polygon

FC-bufF[0] value, FC--bufferF[0] value

Buffer for calculating statistics for point features

FC-circF[0], FC--circularF[0]

Use a circular disc kernel buffer (for vector point sample datasets only, use in combination with buffer option)

FC-vF[0] level, FC--verboseF[0] level

Verbose mode if > 0

History