v.what.vect(1grass)
β¨ v.what.vect β¨
okay so bestie, this is v.what.vect from the GRASS User's Manual and it's literally the "copy the vibe from that map's table over to this map's table" tool π
πΈ NAME πΈ
v.what.vect β uploads vector values at positions of vector points to the table. no cap, that's the whole job π«Ά
π 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, obvi--verboseβ verbose module output (she's chatty, we love her)--quietβ quiet module output (she's giving mystery)--uiβ forces the GUI dialog to launch
π Parameters:
map=name[required] β name of the vector points map whose attributes you wanna edit. can also be a data source for direct OGR access.layer=stringβ layer number or name. vector features can carry category values in different layers, so this number tells her which layer to use. when you're doing direct OGR access this is the layer name. default:1column=name[required] β name of the attribute column that gets updated with the query resultquery_map=name[required] β name of the vector map to be queried. or a data source for direct OGR access.query_layer=stringβ layer number or name, same situation aslayer: different layers, different category values, this picks which one. with direct OGR access it's the layer name. default:1query_column=name[required] β name of the attribute column to be querieddmax=floatβ maximum query distance in map units (meters for ll). default:0.0
π DESCRIPTION π
so v.what.vect transfers attributes out of the query_map's attribute table and into the map's attribute table. icon behavior, truly.
you can use it both ways:
- from a polygon map's table β‘οΈ into a point vector map's attribute table
- or the other way around, from a point map β‘οΈ into the attribute table of a polygon map (peep the examples)
The script is based on v.distance. periodt.
π NOTES π
- the upload column you're stuffing query results into must already exist in
map. if it doesn't, usev.db.addcolumnto add one. don't come crying, just add the column bestie π₯² - use the
dmaxparameter to control the query distance tolerance, i.e. how farmap's points/centroids can be from thequery_mapfeatures. for further options, usev.distance. - here's a lil gotcha: if you have a multipoint input map with several points sharing the same category number, the query result can come out as NULL if that same category number falls into different
query_mappolygons. not me getting a NULL out of nowhere π - when you're transferring attributes from a point map into a polygon map,
dmaxhas to be larger than zero β it'll be determined by the distance between query points and polygon centroids. and importantly: distance is in meters for latitude-longitude projects. remember that fr fr. - if one or both of the input vector maps are 3D, features need to touch in the 3rd dimension (z coordinate) too before attributes get transferred. no z-touch, no transfer. π§
π₯ EXAMPLES π₯
Example one: hospital glow-up π₯
in this one, 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 onto 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: EU CORINE + geonames crossover event β
here, city names, population data and other goodies from Geonames.org country files get transferred onto selected EU CORINE landuse/landcover classes ("Continuous urban fabric", 111, and "Discontinuous urban fabric", 112). Note: The example is in UTM projection to which the input maps have been projected 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)
Latest change: Friday Feb 07 19:16:09 2025 in commit: a82a39f673b97fafcfce1604dc3e6015cb96487a
Main index | Vector index | Topics index | Keywords index | Graphical index | Full index
okay and for the cute sign-off Β© 2003-2026 GRASS Development Team, GRASS 8.5.0 Reference Manual π«Ά and yeah this page ships with GRASS 8.5.0, so respect the version, iykyk π go transfer those attributes bestie, you're gonna ate β¨
π¦ where this page comes from
- alpine 3.24: grass-gis-doc 8.5.0-r1 Β· GPL-2.0-or-later
- ubuntu stonking: grass-doc 8.5.0-1ubuntu1 Β· 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