pkextractimg(1)

πŸ’– pkextractimg πŸ’–

okay bestie, welcome to pkextractimg β€” section 1 of the manual, the "general commands" girlies. this is the tool that pulls pixel values out of your raster using another raster as the map, and honestly? she ate. πŸŽ€


✨ NAME ✨

pkextractimg β€” extract pixel values from a raster image using a raster sample πŸ¦‹


🌸 SYNOPSIS 🌸

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

like, that's it. that's the whole vibe. πŸ‘‘


πŸ’… DESCRIPTION πŸ’…

so here's the tea, bestie: pkextractimg pulls pixel values out of an input raster dataset, based on the locations you hand her via a sample file. she needs you to give her those locations, okay? she's not a mind reader. πŸ™ˆ

the sample should be a raster dataset with categorical (integer) values. the classic use case β€” the one everyone's obsessed with β€” is a land cover map that overlaps your input raster dataset. then the utility goes and extracts pixels from the input raster for the respective land cover classes. iconic behavior, no cap. ✨

want a random subset of the sample raster dataset instead of the whole thing? set the threshold option -t with a percentage value. and the way that you can even give a threshold value for each class (e.g. -t 80 -t 60)? yes ma'am, per-class thresholds, we love to see it. πŸ’… use value 100 to select all pixels for the selected class(es). periodt.

as output, a new copy of the vector file is created, with an extra attribute for the extracted pixel value. and for each raster band in the input image, a separate attribute is created. so, for instance β€” if the raster dataset contains three bands, then three attributes are created (b0, b1 and b2). math is math, bestie. 🧚


πŸŽ€ OPTIONS πŸŽ€

  • -i filename, --input filename β€” the raster input dataset containing band information. your main character. πŸ’–
  • -s sample, --sample sample β€” raster dataset with categorical values, used to sample the input raster dataset. the output will contain features with input band information included. πŸ¦‹
  • -ln layer, --ln layer β€” layer name(s) in the sample. leave it empty to select all of them, girl, go wild. 🌸
  • -rand number, --random number β€” create a simple random sample of points. just provide the number of points to generate. 🎲
  • -grid size, --grid size β€” create a systematic grid of points. provide the cell grid size, in projected units (e.g. m). so organized, so systematic. πŸ‘‘
  • -o filename, --output filename β€” the output sample dataset. this is where the magic lands. ✨
  • -c class, --class class β€” class(es) to extract from the input sample image. leave empty to extract all valid data pixels from the sample dataset. and bestie, listen: make sure to set classes if rule is set to mode, proportion or count. that part is not optional. 😭
  • -t threshold, --threshold threshold β€” probability threshold for selecting samples (randomly). provide the probability in percentage (>0) or absolute (<0). use a single threshold per vector sample layer. if you're 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 the selected class(es). πŸ’―
  • -f format, --f format β€” the output sample dataset format. πŸŽ€
  • -ft fieldType, --ftype fieldType β€” field type. and it's giving... only Real or Integer, those are your two options. πŸ’…
  • -lt labelType, --ltype labelType β€” label type: In16 or String. pick your fighter. πŸ¦‹
  • -b band, --band band β€” band index(es) to extract. leave empty to use all bands. all of them. every single one. 🌈
  • -sband band, --startband band β€” start band sequence number. ⭐
  • -eband band, --endband band β€” end band sequence number. 🏁
  • -bndnodata band, --bndnodata band β€” band(s) in the input image to check if a pixel is valid (used for srcnodata). the vibe check, basically. βœ…
  • -srcnodata value, --srcnodata value β€” invalid value(s) for the input image. the ones we don't claim. πŸ’€
  • -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.). so many babies. 🍼
  • -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. she will simply not stop talking and honestly? we support her. πŸ—£οΈ

🌟 quick reminder, bestie: that's every flag, every default, every value. don't skip any of them or the pixels will simply not be extracted and we'll all be sad. 🫢

and that's the whole page, my love πŸ’œ this was pkextractimg from the pkextractimg(1) manual, sourced and versioned as 01 January 2025, so go forth, extract those pixels, and slay the day away. mwah. πŸ’–βœ¨πŸŽ€πŸ¦‹πŸŒΈπŸ’…πŸ‘‘πŸŒˆβ­

πŸ“¦ where this page comes from