v.sample(1)

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

okay bestie, sit down, hydrate, and let me tell you about v.sample, straight out of the GRASS GIS User's Manual. It samples a raster map at vector point locations, and honestly? It's giving cross-validation main character energy. πŸ¦‹


✨ NAME ✨

v.sample β€” samples a raster map at vector point locations. That's it, that's the whole vibe. πŸ’…


🏷️ KEYWORDS 🏷️

  • vector
  • sampling
  • raster

πŸ“œ 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]

🚩 Flags: 🚩

  • --overwrite β€” lets your output files just go ahead and overwrite files that already exist. chaotic but slay.
  • --help β€” prints the usage summary, for when you need a lil refresher. 🫢
  • --verbose β€” verbose module output, aka it tells you everything. no gatekeeping.
  • --quiet β€” quiet module output. shhh. 🀫
  • --ui β€” forces the GUI dialog to launch. for the visual girlies. ✨

πŸŽ€ Parameters: πŸŽ€

  • input=name [required] β€” name of the input vector point map. 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 gets used. When you're doing direct OGR access, this is the layer name instead. Default: 1.
  • column=name [required] β€” name of the attribute column to use for comparison.
  • output=name [required] β€” name for the output vector map that stores the differences.
  • raster=name [required] β€” name of the raster map to be sampled.
  • method=string β€” the sampling interpolation method, choose your fighter:
    • Options: nearest, bilinear, bicubic
    • Default: nearest
    • nearest: Nearest-neighbor interpolation
    • bilinear: Bilinear interpolation
    • bicubic: Bicubic interpolation
  • zscale=float β€” scaling factor for values read from the raster map. Sampled values get multiplied by this factor. Default: 1.0.

🌸 DESCRIPTION 🌸

v.sample samples a GRASS raster map at the point locations in the input file, using either cubic convolution interpolation, bilinear interpolation, or nearest neighbor sampling (which is the default, btw). Three options, one icon. πŸ”₯

This program may be especially useful when you're sampling for cross validation of interpolations whose output is a raster map. iykyk. 🧚


πŸ“ NOTES πŸ“

The output points will have the easting and northing of the input points. The input category value is used. The input attribute, raster value and difference all get written to output. periodt.

⚠️ When NULL values are encountered for a cell, a zero value is used instead. In these cases, more accurate results may be obtained by using the default nearest neighbor comparisons. lowkey important, don't skip this one bestie.
⚠️ This program may not work properly with lat-long data when the -bc flags are used. not me warning you in advance πŸ’€

When interpolation is done (i.e., the -bc flags are used), values are assumed to be located at the centroid of grid cells. Therefore, current resolution settings are important. so like, check your resolution, okay? 🌈


πŸ’… EXAMPLE πŸ’…

Comparison of "elev_ned_30m" and "elev_srtm_30m" North Carolina sample dataset elevation models at random positions:

# 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

she ate that fr fr πŸ”₯


πŸ‘€ SEE ALSO πŸ‘€

g.region, v.random, v.what.rast Image Sampling Methods - GRASS Tutorial on s.sample (available as s.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

legends only. πŸ’œ


πŸ”— SOURCE CODE πŸ”—

Available at: v.sample source code (history)

Accessed: Saturday Jan 17 05:41:29 2026

Main index | Vector index | Topics index | Keywords index | Graphical index | Full index


Β© 2003-2025 GRASS Development Team, GRASS GIS 8.4.2 Reference Manual

and that's the whole page, bestie β€” this was v.sample(1) from the GRASS GIS User's Manual, running on GRASS 8.4.2, and it was last accessed on that very Saturday, Jan 17 05:41:29 2026. go sample something cute. mwah. πŸ’–πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from