pkinfo(1)

🌸 NAME 🌸

okay so welcome to the pkinfo(1) manual page bestie πŸ’– and here's the tea: pkinfo is your girl for reporting basic information from raster datasets. that's it, that's the whole job, and she does it flawlessly. periodt.


✨ SYNOPSIS ✨

pkinfo -i input [options]

πŸ¦‹ DESCRIPTION πŸ¦‹

so pkinfo pulls up basic information about a raster data set, kinda like what gdalinfo(1) does πŸ‘€ but here's the plot twist, and it's a big one: the way pkinfo differs from gdalinfo is that pkinfo only reports the info you actually ask for with the matching command line option, whereas gdalinfo just dumps every single basic fact at you all at once. no chill, no filter, all of it. pkinfo would never πŸ’…

and the way she formats that info? it's in a format you can feed straight back in as input to other pktools utilities 🫢 which means you can do command substitution in the bash scripting language and it just works. iconic behavior honestly.


πŸ‘‘ OPTIONS πŸ‘‘

  • -i filename, --input filename β€” the input image file, aka the whole reason we're here 🌟
  • -bb, --bbox β€” shows the bounding box
  • -te, --te β€” shows the bounding box in GDAL format: xmin ymin xmax ymax
  • -c, --center β€” the image center in projected X,Y coordinates
  • -ct, --colortable β€” shows the colour table
  • -ns, --nsample β€” how many samples are in the image
  • -nl, --nline β€” how many lines are in the image
  • -nb, --nband β€” shows how many bands are in the image
  • -b band, --band band β€” band specific information πŸŽ€
  • -dx, --dx β€” gets the resolution in x (in m)
  • -dy, --dy β€” gets the resolution in y (in m)
  • -mm, --minmax β€” shows the min and max value of the image
  • -min, --minimum β€” shows the min value of the image
  • -max, --maximum β€” shows the max value of the image
  • -stats, --statistics β€” shows statistics, specifically (min,max, mean and stdDev of the image)
  • -a_srs, --a_srs β€” shows the projection of the image
  • -geo, --geo β€” gets the geotransform
  • -il, --interleave β€” no description in the source bestie, she's just out here living her truth πŸ™ˆ
  • -f, --filename β€” shows the image filename
  • -cover, --cover β€” prints the filename to STDOUT if the current image covers the coordinates you provided, either via bounding box, (x y) coordinates, or the extent of a vector file
  • -x value, --xpos value β€” x pos
  • -y value, --ypos value β€” y pos
  • -r, --read β€” reads row y (in projected coordinates if the geo option is set, otherwise in image coordinates, 0 based)
  • -ref, --reference β€” gets the reference pixel (lower left corner of center of gravity pixel)
  • -of, --oformat β€” gets the driver description
  • -e filename, --extent filename β€” gets the boundary from a vector file
  • -ulx ULX, --ulx ULX β€” upper left x value bounding box
  • -uly ULY, --uly ULY β€” upper left y value bounding box
  • -lrx LRX, --lrx LRX β€” lower right x value bounding box
  • -lry LRY, --lry LRY β€” lower right y value bounding box
  • -ot, --otype β€” also no description in the source, she's mysterious like that πŸ’€
  • -d, --description β€” returns the image description
  • -meta, --meta β€” shows meta data
  • -nodata value, --nodata value β€” sets the no data value(s) for calculations (the nodata values in the input image)

🌈 EXAMPLE 🌈

show the number of bands in the raster image.tif:

pkinfo -i image.tif -nb

show the maximum value of band 1 (starting from 0) of the raster image.tif:

pkinfo -i image.tif -max -b 1

read (dump) the upper left pixel value for bands 3,2,1:

pkinfo -i image.tif -x 0 -y 0 -r -b 3 -b 2 -b 1

read (dump) the pixel value at this geographic location (x,y) for bands 3,2,1:

pkinfo -i image.tif -x 3528120 -y 4329681 -geo -r -b 3 -b 2 -b 1

show the bounding box (-ulx -uly -lrx -lry) in geo coordinates for image1.tif:

pkinfo -i image1.tif -b

show the bounding box (-ulx -uly -lrx -lry) in geo coordinates for each image (and union and intersect):

pkinfo -i image1.tif -i image2.tif -i image3.tif -b

show the reference pixel (centre of gravity) for image1.tif, treating 0 and 255 as NO VALUE:

pkinfo -i image1.tif --mask 0 --mask 255 -ref

read (dump) the pixel value at the image centre for band 0:

pkinfo -i image.tif $(pkinfo -i image.tif -c) -geo -r

read (dump) the pixel value in band 0 (the default) for all images in the current directory that cover this geographic location:

pkinfo $(for IMAGE in modis_2010*.tif; do pkinfo -i $IMAGE --cover -x 4215500 -y 2534000; done) -x 4215500 -y 253400

🫢 SEE ALSO 🫢

gdalinfo(1) β€” the loud one who says everything at once 😭


and that's the whole page bestie, you ate it up πŸ’… go forth and interrogate some rasters πŸ’–

okay so this was pkinfo(1), dated 01 January 2025 β€” love her, she's timeless βœ¨πŸŽ€πŸŒΈ

πŸ“¦ where this page comes from