v.what.rast3(1grass)

πŸ’– v.what.rast3 β€” the GRASS User's Manual glow-up πŸ’–

okay bestie, sit DOWN, because this is the module that takes 3D raster values and yeets them into your vector attribute table at exactly the right point positions. it's v.what.rast3, from the GRASS User's Manual, and she is lowkey iconic. πŸ¦‹


✨ NAME ✨

v.what.rast3 β€” uploads 3D raster values at positions of vector points to the table. that's the whole job. she samples, she writes, she goes home. πŸ’…


πŸŽ€ KEYWORDS πŸŽ€

<vector>vector</vector>, sampling, raster, position, querying, attribute table, surface information

(aka all the search terms you'd type at 2am trying to find her again 🫢)


🌸 SYNOPSIS 🌸

the way she wants to be called:

v.what.rast3
v.what.rast3 --help
v.what.rast3 map=name  [layer=string]  raster_3d=name column=name
[where=sql_query]   [--help]  [--verbose]  [--quiet]  [--ui]

🌈 Flags

  • --help β€” print the usage summary. your lil "wait what does this do again" button. πŸ’–
  • --verbose β€” verbose module output. she tells you EVERYTHING. not me loving the yapping πŸ—£οΈ
  • --quiet β€” quiet module output. shhh. she's in her silent era. 🀫
  • --ui β€” force launching the GUI dialog. for when clicking > typing. πŸŽ€

🧚 Parameters

  • map=name [required] β€” name of the vector points map you wanna edit attributes for. or, plot twist, a data source for direct OGR access. πŸ™ˆ
  • layer=string β€” layer number or name. vector features can have category values in different layers, and this number decides which layer we're on. when you're using direct OGR access, this is the layer name instead. default? 1, obviously. ⭐
  • raster_3d=name [required] β€” name of an existing 3D raster map to be queried. the source of truth. the main character. πŸ‘‘
  • column=name [required] β€” name of the attribute column that gets updated with the query result. the glow-up destination. ✨
  • where=sql_query β€” WHERE conditions of an SQL statement, written without the where keyword, bestie, don't add it. example: income < 1000 and population >= 10000. πŸ’œ

πŸ’… DESCRIPTION πŸ’…

okay so v.what.rast3 reads the 3D raster value for each point in your vector, and then updates the col column in the vector attribute table with that value. no cap.

the column should be type double. don't fight her on this.

this module is based on v.what.rast β€” so if you know her, you know this one's vibe. 🌸

and now the important bits, listen up:

if more points have the same category, the attribute value is set to NULL. fr fr, that's what happens.
if the 3D raster value is NULL, the attribute value is set to NULL. yes, really. NULL in, NULL out. πŸ’€

πŸ¦‹ NOTES πŸ¦‹

silence πŸ’–

(this section is empty in the original, and honestly? leaving space for the mystery. she said nothing and understood everything. πŸ™ˆ)


πŸ”₯ EXAMPLES πŸ”₯

A) πŸ’« the classic

reading values from a 3D raster map at the position of vector points, and writing those values into a column of the attribute table connected to the vector map:

v.what.rast3 map=pnts raster3d=plume column=concentration

B) 🌈 the build-it-from-scratch

in case of a vector map without an attached attribute table, first add a new attribute table. this table is then populated with values queried from the raster map:

# create new random 3d vector points map
v.random -z output=pnts npoints=100 zmin=0  zmax=50
# add new table, link to map
v.db.addtable map=pnts column="concentration double precision"
# query raster map and upload values to vector table into specified column
g.region raster3d=plume -p
v.what.rast3 map=pnts raster3d=plume column=concentration
# verify new attribute table:
v.db.select map=pnts
# verify statistics of uploaded values:
v.univar map=pnts column=concentration type=point

and that's the whole pipeline, bestie. create, link, query, upload, verify, verify again. she ate and left no crumbs. 😭🫢

okay tiny heads-up: that second example literally writes raster3d=plume, not raster_3d=plume. we're keeping it exactly as the page has it, char for char, no editing the queen. πŸ‘‘

πŸ‘€ SEE ALSO πŸ‘€

go check out her friends, they're all so valid:

  • v.db.addtable
  • v.db.select
  • v.what.rast
  • v.what.vect
  • v.univar

🌟 AUTHOR 🌟

Soeren Gebbert, heavily based on v.what.rast by Radim Blazek.

shoutout to the two of them, absolute legends, standing on each other's shoulders like the iconique collab it is. πŸ’œ


πŸŽ€ SOURCE CODE πŸŽ€

available at: v.what.rast3 source code (history)

latest change: Friday Feb 07 19:16:09 2025 in commit: a82a39f673b97fafcfce1604dc3e6015cb96487a

main index | vector index | topics index | keywords index | graphical index | full index


and that's the page, bestie β€” she's v.what.rast3(1grass), she ships with GRASS 8.5.0, and she's copyrighted Β© 2003-2026 GRASS Development Team, GRASS 8.5.0 Reference Manual. periodt. now go sample some 3D rasters, you gorgeous genius. πŸ’–βœ¨πŸ¦‹

πŸ“¦ where this page comes from