pktools
2.6.7
Processing Kernel for geospatial data
|
perform raster data operations on image such as crop, extract and stack bands
Usage: pkcrop -i input -o output
Options: [-of out_format] [-ot {Byte/Int16/UInt16/UInt32/Int32/Float32/Float64/CInt16/CInt32/CFloat32/CFloat64}] [-b band]* [-ulx ULX -uly ULY -lrx LRX -lry LRY] [-dx xres] [-dy yres] [-r resampling_method] [-a_srs epsg:number] [-nodata value]
Advanced options: [-e vector [-cut] [-eo option]*] [-sband band -eband band]* [-co NAME=VALUE]* [-x center_x -y center_y] [-nx size_x -ny size_y] [-ns nsample -nl nlines] [-as min -as max] [-scale value]* [-off offset]* [-ct colortable] [-d description] [-align]
The utility pkcrop can subset and stack raster images. In the spatial domain it can crop a bounding box from a larger image. The output bounding box is selected by setting the new corner coordinates using the options -ulx -uly -lrx -lry. Alternatively you can set the new image center (-x -y) and size. This can be done either in projected coordinates (using the options -nx -ny) or in image coordinates (using the options -ns -nl). You can also use a vector file to set the new bounding box (option -e). In the spectral domain, pkcrop allows you to select individual bands from one or more input image(s). Bands are stored in the same order as provided on the command line, using the option -b. Band numbers start with index 0 (indicating the first band). The default is to select all input bands. If more input images are provided, the bands are stacked into a multi-band image. If the bounding boxes or spatial resolution are not identical for all input images, you should explicitly set them via the options. The pkcrop utility is not suitable to mosaic or composite images. Consider the utility pkcomposite instead.
-short
or --long
options (both --long=value
and --long value
are supported)-h
shows basic options only, long option --help
shows all options short | long | type | default | description |
---|---|---|---|---|
i | input | std::string | Input image file(s). If input contains multiple images, a multi-band output is created | |
o | output | std::string | Output image file | |
a_srs | a_srs | std::string | Override the projection for the output file (leave blank to copy from input file, use epsg:3035 to use European projection and force to European grid | |
ulx | ulx | double | 0 | Upper left x value bounding box |
uly | uly | double | 0 | Upper left y value bounding box |
lrx | lrx | double | 0 | Lower right x value bounding box |
lry | lry | double | 0 | Lower right y value bounding box |
b | band | unsigned short | band index to crop (leave empty to retain all bands) | |
sband | startband | unsigned short | Start band sequence number | |
eband | endband | unsigned short | End band sequence number | |
as | autoscale | double | scale output to min and max, e.g., –autoscale 0 –autoscale 255 | |
ot | otype | std::string | Data type for output image ({Byte/Int16/UInt16/UInt32/Int32/Float32/Float64/CInt16/CInt32/CFloat32/CFloat64}). Empty string: inherit type from input image | |
of | oformat | std::string | GTiff | Output image format (see also gdal_translate) |
ct | ct | std::string | color table (file with 5 columns: id R G B ALFA (0: transparent, 255: solid) | |
dx | dx | double | Output resolution in x (in meter) (empty: keep original resolution) | |
dy | dy | double | Output resolution in y (in meter) (empty: keep original resolution) | |
r | resampling-method | std::string | near | Resampling method (near: nearest neighbor, bilinear: bi-linear interpolation). |
e | extent | std::string | get boundary from extent from polygons in vector file | |
cut | crop_to_cutline | bool | false | Crop the extent of the target dataset to the extent of the cutline |
eo | eo | std::string | special extent options controlling rasterization: ATTRIBUTE or CHUNKYSIZE or ALL_TOUCHED or BURN_VALUE_FROM or MERGE_ALG, e.g., -eo ATTRIBUTE=fieldname | |
m | mask | std::string | Use the specified file as a validity mask (0 is nodata) | |
msknodata | msknodata | float | 0 | Mask value not to consider for crop |
mskband | mskband | short | 0 | Mask band to read (0 indexed) |
co | co | std::string | Creation option for output file. Multiple options can be specified. | |
x | x | double | x-coordinate of image center to crop (in meter) | |
y | y | double | y-coordinate of image center to crop (in meter) | |
nx | nx | double | image size in x to crop (in meter) | |
ny | ny | double | image size in y to crop (in meter) | |
ns | ns | int | number of samples to crop (in pixels) | |
nl | nl | int | number of lines to crop (in pixels) | |
scale | scale | double | output=scale*input+offset | |
off | offset | double | output=scale*input+offset | |
nodata | nodata | float | Nodata value to put in image if out of bounds. | |
align | align | bool | Align output bounding box to input image | |
d | description | std::string | Set image description |
Some examples how to use pkcrop can be found here