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? usev.db.addcolumnto add one. no skipping this step, bestie. π - use the
dmaxparameter to control the query distance tolerance β aka how farmap's points/centroids are allowed to be from thequery_mapfeatures. want even more knobs? go usev.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 differentquery_mappolygons. messy. π - when you're transferring attributes from a point map into a polygon map,
dmaxhas 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
- 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