v.sample(1grass)
β¨ v.sample β the manual page, but make it cute β¨
okay bestie, welcome to v.sample(1grass) π this is the GRASS User's Manual page for it, and no I will not be normal about it.
πΈ NAME πΈ
v.sample β it samples a raster map at vector point locations. that's it, that's the whole job, and it does it beautifully. π
π KEYWORDS π
vector, sampling, raster β iykyk π¦
π SYNOPSIS π
v.sample
v.sample --help
v.sample input=name [layer=string] column=name output=name raster=name
[method=string] [zscale=float] [--overwrite] [--help] [--verbose]
[--quiet] [--ui]
look at that. mostly required args, a couple optional ones, and the classic GRASS flags doing their thing. periodt π
π«Ά Flags
--overwriteβ lets your output files just bulldoze whatever was already there. existing files? gone. allow output files to overwrite existing files.--helpβ prints the usage summary. your safety net when you forget what anything means. π--verboseβ verbose module output. it will tell you EVERYTHING, and honestly? good for it.--quietβ quiet module output. the opposite vibe. shhh. π€«--uiβ force launches the GUI dialog. buttons!! β¨
π§ Parameters
input=name[required] β name of the input vector point map. or, plot twist, it can be a data source for direct OGR access. main character energy either way. πlayer=stringβ layer number or name. here's the tea: vector features can have category values in different layers, and this number determines which layer to use. when you're doing direct OGR access, this is instead the layer name. Default:1column=name[required] β name of the attribute column to use for comparison.output=name[required] β name for the output vector map where the differences get stored. the receipts, basically. πraster=name[required] β name of the raster map to be sampled. the star of the show.method=stringβ sampling interpolation method. the options are:nearest,bilinear,bicubic. Default:nearestnearestβ nearest-neighbor interpolationbilinearβ bilinear interpolationbicubicβ bicubic interpolation
zscale=floatβ scaling factor for values read from the raster map. the sampled values get multiplied by this factor. Default:1.0
π DESCRIPTION π
so v.sample samples a GRASS raster map at the point locations in your input file. and it does it via one of three routes: cubic convolution interpolation, bilinear interpolation, or nearest neighbor sampling (that last one is the default, if you were wondering π
).
this program can be especially useful when you're sampling for cross validation of interpolations whose output happens to be a raster map. it's giving "the tool you didn't know you needed". π
π NOTES π
okay here's the important stuff, bestie, don't scroll past:
- the output points will have the easting and northing of the input points. literally the same coords, no cap.
- the input category value is used.
- the input attribute, the raster value, and the difference all get written to output. three-for-one deal. π₯
- when NULL values are encountered for a cell, a zero value is used instead. in those cases, you might get more acurrate results by using the default nearest neighbor comparisons. (that's spelled the original way, live with it π)
- this program may not work properly with lat-long data when the
-bcflags are used. - when interpolation is done (i.e., when the
-bcflags are used), values are assumed to be located at the centroid of grid cells. so your current resolution settings matter a LOT. don't ignore them. β
lowkey a warning: lat-long data + -bc flags = possible chaos. and resolution settings when interpolating? not optional to care about. π
π EXAMPLE π
this is a comparison of "elev_ned_30m" and "elev_srtm_30m" North Carolina sample dataset elevation models at random positions. iconic dataset behaviour, honestly. π¦
# set computational region:
g.region raster=elev_srtm_30m -p
# generate random points:
v.random output=random n=100
# add table with one column:
v.db.addtable random col="elev_srtm30 double precision"
# transfer elevations at random points into table:
v.what.rast map=random rast=elev_srtm_30m col=elev_srtm30
# verify:
v.db.select random
# perform sampling on other elevation map:
v.sample in=random col=elev_srtm30 rast=elev_ned_30m out=elev_samples
#verify:
v.db.select elev_samples
#univariate statistics of differences between elevation maps:
v.univar elev_samples column=diff type=point
see how it flows?? set region, make points, build a table, transfer values, verify, sample, verify again, then univar the diffs. a whole little journey and it ATE. π β¨
π SEE ALSO π
g.regionv.randomv.what.rast- Image Sampling Methods - GRASS Tutorial on
s.sample(available ass.sample-tutorial.ps.gz)
π AUTHORS π
- James Darrell McCauley β when he was at: Agricultural Engineering Purdue University
- Updated for GRASS 5.0 by Eric G. Miller
- Updated for GRASS 5.7 by Radim Blazek
π SOURCE CODE π
available at: v.sample source code (history)
latest change: Friday May 09 14:33:40 2025 in commit: b356c7e108fcbeca77474c8e83ebec8f1e7b3e4a
Main index | Vector index | Topics index | Keywords index | Graphical index | Full index
and that's the whole page bestie π«Ά this came out of GRASS 8.5.0 β the GRASS 8.5.0 Reference Manual β with Β© 2003-2026 GRASS Development Team holding it down. this specific page was last touched Friday May 09 14:33:40 2025 in commit b356c7e108fcbeca77474c8e83ebec8f1e7b3e4a, and it's filed under v.sample(1grass). go sample something. ππ
π¦ where this page comes from
- alpine 3.24: grass-gis-doc 8.5.0-r1 Β· GPL-2.0-or-later
- ubuntu stonking: grass-doc 8.5.0-1ubuntu1 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms