v.what.vect(1)

πŸ’– v.what.vect β€” the GRASS GIS manual, but make it make sense πŸ’–

okay bestie, so this is v.what.vect(1), a page from the GRASS GIS User's Manual, and it's genuinely one of the most useful little vector tools out there. it takes attribute values sitting in one vector map and yeets them into the attribute table of another vector map. no cap, that's the whole vibe. πŸ¦‹


✨ NAME ✨

v.what.vect β€” uploads vector values at positions of vector points to the table. πŸ’…


πŸŽ€ KEYWORDS πŸŽ€

vector, sampling, database, position, querying, attribute table


🌸 SYNOPSIS 🌸

v.what.vect
v.what.vect --help
v.what.vect map=name  [layer=string]  column=name query_map=name
[query_layer=string]  query_column=name  [dmax=float]   [--help]
[--verbose]  [--quiet]  [--ui]

🧚 Flags

  • --help β€” prints the usage summary, i.e. the "wait what do I type" button.
  • --verbose β€” verbose module output. it will not shut up (affectionately).
  • --quiet β€” quiet module output. it will simply not speak.
  • --ui β€” forces the GUI dialog to launch. main character energy for your mouse. πŸ–±οΈβœ¨

πŸ“ Parameters

  • map=name [required] β€” the name of the vector points map whose attributes you wanna edit. or, plot twist, it can be a data source for direct OGR access.
  • layer=string β€” layer number or name. lowkey important context: vector features can have category values in different layers, and this number decides which layer we're playing in. when you're using direct OGR access, this is the layer name instead. default: 1.
  • column=name [required] β€” the name of the attribute column that gets updated with the query result. this is the destination, bestie. 🎯
  • query_map=name [required] β€” the name of the vector map being queried. or a data source for direct OGR access.
  • query_layer=string β€” layer number or name, same situation as above: vector features can have category values in different layers, this number picks which one. with direct OGR access it's the layer name. default: 1.
  • query_column=name [required] β€” the name of the attribute column being queried. this is the source of the tea. πŸ«–
  • dmax=float β€” maximum query distance in map units (meters for ll). default: 0.0.

πŸ’œ DESCRIPTION πŸ’œ

so v.what.vect transfers attributes from the query_map's attribute table into the map's attribute table. that's it, that's the plot. 🌈

it goes both ways and that's the iconic part: you can move attributes from a polygon map's table into a point vector map's attribute table, and the other way around β€” from a point map into a polygon map's attribute table (peep the examples below, they show it off). and the script is based on v.distance, so if you've met that one you already know the family. πŸ‘‘


⭐ NOTES ⭐

  • the upload column where the query results land must already exist in map. not there? use v.db.addcolumn to add one. no skipping this step, bestie. πŸ™ˆ
  • use the dmax parameter to control the query distance tolerance β€” aka how far map's points/centroids are allowed to be from the query_map features. want even more knobs? go use v.distance. πŸ”§
  • heads up: if you have a multipoint input map where several points share the same category number, it can happen that the query result is NULL β€” this is when the same category number falls into different query_map polygons. messy. πŸ’€
  • when you're transferring attributes from a point map into a polygon map, dmax has to be larger than zero, because it gets determined by the distance between query points and polygon centroids. and importantly: for latitude-longitude projects, that distance is in meters. πŸ“
  • if one or both of your input vector maps are 3D, the features need to touch in the 3rd dimension too (the z coordinate) in order for attributes to transfer. yes, z matters. z always matters. πŸ¦‹

πŸ”₯ EXAMPLES πŸ”₯

πŸ₯ Example one: hospitals, but make it urban

in this example, the 'hospitals' point map from the North Carolina dataset gets copied into the current mapset, a new attribute column gets added, and the urban names from the 'urbanarea' polygon map get transferred to the hospital point locations in the 'myhospitals' map:

g.copy vect=hospitals,myhospitals
v.db.addcolumn myhospitals column="urb_name varchar(25)"
v.what.vect myhospitals query_map=urbanarea column=urb_name query_column=NAME
# verification:
v.db.select myhospitals

πŸ™οΈ Example two: geonames cities into CORINE landcover classes

in this example, city names, population data and others from Geonames.org country files get transferred onto selected EU CORINE landuse/landcover classes ("Continuous urban fabric", 111, and "Discontinuous urban fabric", 112). note: this example is in UTM projection, which the input maps had been projected to beforehand.

# extract populated places from geonames
v.extract geonames_IT where="featurecla='P'" output=geonames_IT_cities
# add new column
v.db.addcol corine_code111_112_cities column="gnameid double precision"
# transfer geonameid (3000m maximal distance between points and centroids)
v.what.vect corine_code111_112_cities query_map=geonames_IT_cities column=gnameid \
            query_column=geonameid dmax=3000
# now gnameid can be used for v.db.join to join further
# attributes from geonames.org

🌟 SEE ALSO 🌟

v.db.addcolumn, v.db.select, v.distance, v.rast.stats, v.what.rast, v.what.rast3, v.vect.stats


πŸ‘‘ AUTHOR πŸ‘‘

Markus Neteler


πŸ’… SOURCE CODE πŸ’…

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

accessed: Saturday Jan 17 05:41:53 2026

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


and that's the whole page, bestie β€” go transfer some attributes, you're literally so good at this. πŸ’–βœ¨πŸ¦‹

this was the GRASS GIS 8.4.2 Reference Manual, version GRASS 8.4.2, Β© 2003-2025 GRASS Development Team. mwah. πŸ’‹

πŸ“¦ where this page comes from