v.neighbors(1)
π v.neighbors(1) β the GRASS GIS User's Manual glow-up β¨
okay so bestie, welcome to v.neighbors, one of those GRASS GIS modules that sounds boring and is actually kinda iconic once you get it. it lives in the GRASS GIS User's Manual, and it's about to become your new hyperfixation. π¦
πΈ NAME πΈ
Neighborhood analysis tool for vector point maps, fr fr.
What it does: makes each cell value a function of the attribute values assigned to the vector points or centroids in a radius around it, and stores new cell values in an output raster map. like, it literally looks around every cell and goes "hmm who's nearby π". the way that it aggregates? obsessed.
π KEYWORDS π
vector, algebra, statistics, raster, aggregation
β¨ SYNOPSIS β¨
v.neighbors
v.neighbors --help
v.neighbors input=name [layer=string] output=name method=string
size=float [points_column=name] [cats=range] [where=sql_query]
[--overwrite] [--help] [--verbose] [--quiet] [--ui]
π Flags π
these are the little switches, the mood rings of the module:
--overwriteβ Allow output files to overwrite existing files. (yes queen, go ahead and replace it, no cap)--helpβ Print usage summary. your bestie when you forget everything.--verboseβ Verbose module output. it will tell you everything. main character energy.--quietβ Quiet module output. shhh π€«--uiβ Force launching GUI dialog. for when you want buttons instead of typing.
π«Ά Parameters π«Ά
input=name[required] β Name of input vector map. Or data source for direct OGR access.layer=stringβ Layer number or name. Vector features can have category values in different layers. This number determines which layer to use. When used with direct OGR access this is the layer name. Default:1.output=name[required] β Name for output raster map. this is where the magic gets written πmethod=string[required] β Method for aggregate statistics (countif non given). Options:count,sum,average,median,mode,minimum,maximum,range,stddev,variance,diversity. Default:count.size=float[required] β Neighborhood diameter in map units. diameter, bestie. remember that. we'll come back to it.points_column=nameβ Column name of points map to use for statistics. Column of points map must be numeric.cats=rangeβ Category values. Example:1,3,7-9,13where=sql_queryβ WHERE conditions of SQL statement without 'where' keyword. Example:income < 1000 and population >= 10000
π DESCRIPTION π
okay so here's the vibe. this module makes each cell value a function of the attribute values assigned to the vector points or centroids in an area around the cell with a diameter of size around it, and stores the new cell values in the output raster map layer. by default, the module just counts the number of points β literally just "how many of y'all are here π₯°". but you can also choose amongst a variety of aggregate statistics using the parameter method. these statistics are calculated on the attributes in the point_column. and using the usual cats and where parameters the user can chose to take only a subset of the points into account. cherry-picking, but make it spatial. π
β οΈ important, no skipping: note that size is defined as the diameter, and so has to be twice the wanted search radius. half of it is your actual radius, iykyk.
and also β the module works within the current computational region, which can be adjusted using g.region. if the vector map falls completely outside the current region, the module will stop with an error. like, full stop. π region check first, always.
π EXAMPLE π
Count the number of schools for a given grid (North Carolina sample dataset):
g.region vector=schools_wake res=100 -p -a
v.neighbors input=schools_wake output=schools_wake_3000m method=count size=3000
d.mon wx0
d.rast schools_wake_3000m
d.vect schools_wake
The result gives for each grid cell the number of points (here: schools) not farther than 1500 meter away (half of the given size value) from the respective cell center. see? told you size was a diameter. π
Calculate the mean capacity of schools for the same grid:
v.neighbors input=schools_wake output=schools_capacity point_column=CAPACITYTO \
method=average size=3000
(and yes bestie, the manpage literally writes point_column there while the parameter is named points_column β copy it exactly as written, don't @ me π
)
π SEE ALSO π
r.neighborsv.vect.stats
go read those too, they're giving the same energy.
π AUTHORS π
- Radim Blazek
- Moritz Lennert
icons. legends. the blueprint. π
π¦ SOURCE CODE π¦
Available at: v.neighbors source code (history)
Accessed: Saturday Jan 17 05:41:24 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 thing, bestie π this page came straight outta GRASS 8.4.2, dated Saturday Jan 17 05:41:24 2026, and it's v.neighbors(1) β neighborhood analysis that ate. periodt. πβ¨
π¦ where this page comes from
- fedora 44: grass 8.4.2-4.fc44 Β· 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