User Tools

Site Tools


wiki:pksetmask

pksetmask

NAME

 pksetmask - apply mask to raster file

SYNOPSIS

   pksetmask -i input -o output [OPTION]

DESCRIPTION

 Apply mask (flag invalid values) to raster file according to given mask (raster file)
     

OPTIONS

   -i     --input                Input image (default: <empty string>)
   -m     --mask                 Mask image(s) (default: <empty string>)
   -o     --output               Output mask file (default: <empty string>)
   -ot    --otype                Data type for output image ({Byte/Int16/UInt16/UInt32/Int32/Float32/Float64/CInt16/CInt32/CFloat32/CFloat64}). Empty string: inherit type from input image (default: <empty string>)
   -of    --oformat              Output image format (see also gdal_translate). Empty string: inherit from input image (default: <empty string>)
   -co    --co                   options: NAME=VALUE [-co COMPRESS=LZW] [-co INTERLEAVE=BAND] (default: <empty string>)
   -t     --invalid              Mask value(s) where image is invalid. Use one value for each mask, or multiple values for a single mask. (default: 1)
   -p     --operator             Operator: < = > !. Use operator for each invalid option (default: =)
   -f     --flag                 Flag value to put in image if not valid (0) (default: 0)
   -ct    --ct                   color table (file with 5 columns: id R G B ALFA (0: transparent, 255: solid) (default: <empty string>)
   -v     --verbose              verbose (default: 0)

Examples

pksetmask -i input.tif -m mask.tif -o output.tif -ot Byte -t 0 -f 255 # copy pixel values from input.tif to output.tif, applying mask.tif, setting all values to 255 where mask is 0.
 
pksetmask -i input.tif -m mask.tif -o output.tif -ot Byte -t 1 -f 255 --operator '!' # copy values from input.tif to output.tif, but set all values to 255 if mask is not 1
 
pksetmask -i input.tif -m mask1.tif -m mask2.tif -o output.tif -ot Byte -t 0 -f 255 # copy pixel values from input.tif to output.tif, applying two masks, setting all values to 255 where either mask is 0.
 
pksetmask -i input.tif -m mask.tif -o output.tif -ot Byte -t 0 -t 1 -f 255 -f 255 # copy pixel values from input.tif to output.tif, applying single masks, setting all values to 255 where mask is either 0 or 1.
 
pksetmask -i input.tif -m mask.tif -o output.tif -ot Byte -t 0 -t 1 -f 255 -f 255 # copy pixel values from input.tif to output.tif, applying single masks, setting all values to 255 where mask is either 0 or 1.
wiki/pksetmask.txt · Last modified: 2017/12/05 22:53 (external edit)