v.neighbors(1grass)

πŸ’– v.neighbors β€” the manual, but make it make sense πŸ’–

okay bestie, settle in, because this is v.neighbors from the GRASS User's Manual and it's genuinely iconic once you get the vibe. no cap.


✨ NAME ✨

v.neighbors β€” Neighborhood analysis tool for vector point maps. It 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. πŸ¦‹


🌸 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 πŸŽ€

  • --overwrite β€” Allow output files to overwrite existing files. yes she will delete your old raster, she's not asking twice πŸ’…
  • --help β€” Print usage summary
  • --verbose β€” Verbose module output
  • --quiet β€” Quiet module output
  • --ui β€” Force launching GUI dialog

🧚 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
  • method=string [required] β€” Method for aggregate statistics (count if non given). Options: count, sum, average, median, mode, minimum, maximum, range, stddev, variance, diversity. Default: count
  • size=float [required] β€” Neighborhood diameter in map units
  • 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,13
  • where=sql_query β€” WHERE conditions of SQL statement without 'where' keyword. Example: income < 1000 and population >= 10000

πŸ’œ DESCRIPTION πŸ’œ

So here's the tea: 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 (lowkey its whole personality). 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. Using the usual cats and where parameters the user can chose to take only a subset of the points into account. ✨

⚠️ Bestie, listen. <red>**size is defined as the diameter**</red>, and so has to be twice the wanted search radius.And the module works within the current computational region which can be adjusted usingg.region`. If the vector map falls completely outside the current region, the module will stop with an error. it's giving boundaries. πŸ’€

πŸ”₯ 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. πŸŽ€

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

🌈 SEE ALSO 🌈

r.neighbors, v.vect.stats


πŸ‘‘ AUTHORS πŸ‘‘

Radim Blazek, Moritz Lennert


πŸ“ SOURCE CODE πŸ“

Available at: v.neighbors 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 whole manual, bestie, you ate. 🫢 Signing off with the receipts: this was the GRASS 8.5.0 Reference Manual, Β© 2003-2026 GRASS Development Team, and the latest change to this page happened Friday Feb 07 19:16:09 2025 in commit a82a39f673b97fafcfce1604dc3e6015cb96487a. go run it, v.neighbors is waiting and she's literally ready. πŸ’…βœ¨

πŸ“¦ where this page comes from