v.extract(1)
π v.extract(1) β GRASS GIS User's Manual π
okay bestie, sit down, hydrate, because this is the page for v.extract and it's genuinely iconic. It's a GRASS GIS manual page (yes, the one for v.extract(1)), and it's about grabbing the vector features you want out of a map and yeeting them into a brand new map. only the chosen ones make it. π
β¨ NAME β¨
v.extract β selects vector features from an existing vector map and creates a new vector map containing only the selected features. no strays, no extras. it's giving curated. π¦
π KEYWORDS π
vector, extract, select, dissolve, random
πΈ SYNOPSIS πΈ
v.extract
v.extract --help
v.extract [-dtr] input=name [layer=string] [type=string[,string,...]]
[cats=range] [where=sql_query] output=name [file=name]
[random=integer] [new=integer] [dissolve_column=name]
[--overwrite] [--help] [--verbose] [--quiet] [--ui]
π© Flags
-dβ dissolve common boundaries (default is no)-tβ do not copy attributes (peep thenewparameter too, iykyk)-rβ reverse selection π--overwriteβ allow output files to overwrite existing files (chaotic but fine)--helpβ print usage summary--verboseβ verbose module output (she's chatty)--quietβ quiet module output (she's mysterious)--uiβ force launching GUI dialog
π Parameters
input=name[required] β name of input vector map. or, plot twist, a data source for direct OGR access.layer=stringβ layer number or name ('-1'for all layers). a single vector map can be connected to multiple database tables, and this number determines which table to use. when used with direct OGR access this is the layer name. default:1.type=string[,string,...]β types to be extracted. this is the input feature type. options:point,line,boundary,centroid,area,face. default:point,line,boundary,centroid,area,face(yes, all of them, she's generous π).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.output=name[required] β name for output vector map. the glow-up destination. β¨file=nameβ input text file with category numbers/number ranges to be extracted. if'-'given, reads from standard input.random=integerβ number of random categories matching vector objects to extract. number must be smaller than unique cat count in layer. β οΈnew=integerβ desired new category value (enter-1to keep original categories). ifnew >= 0, attributes is not copied. default:-1.dissolve_column=nameβ name of attribute column for dissolving areas. preserves category values.
π DESCRIPTION π
v.extract allows a user to select vector objects from an existing vector map and creates a new map containing only the selected objects. basically: you point at stuff, she keeps it, everything else is not invited to the party. π«Ά
database tables can be queried with SQL statements, if a connection is established. dissolving (optional) is based on the output categories β and the way that works is, if 2 adjacent areas have the same output category, the boundary is removed. gone. deleted. no boundary between besties. π
if cats, file, random or where options are not specified, all features of given type and layer are extracted. categories are not changed in that case. (yes, everything, she's not picky today.)
π NOTES π
only features with a category number in the selected layer will be extracted. so if you want to extract boundaries β which are usually without category, since that information is normally held in the area's centroid β you must first usev.categoryto add them, or uselayer=-1. no cap, this trips people up every single time. π
π EXAMPLES π
these examples are intended for the North Carolina sample dataset. let's get into it.
π Extract areas by category number with dissolving #1
v.extract -d cats=1,2,3,4 input=soils_wake output=soil_groupa type=area new=0
produces a new vector soil_groupa, containing those areas from vector soils which have category numbers 1 thru 4; any common boundaries are dissolved, and all areas in the new map will be assigned category number 0. slay. β¨
π Extract areas by category number with dissolving #2
v.extract -d cats=1-4 input=soils_wake output=soil_groupa type=area new=-1
produces a new vector map soil_groupa containing the areas from vector soils which have categories 1 thru 4. any common boundaries are dissolved, all areas in the new map will retain their original category numbers 1 thru 4, since new was set to -1. iconic behaviour, honestly. π
π Extract all areas and assign the same category to all
v.extract input=soils_wake output=soil_groupa type=area new=1
produces a new vector map soil_groupa containing all areas from soils. no common boundaries are dissolved, all areas of the new map will be assigned category number 1. everyone matching, matching, yes. π
π Extract vectors with SQL
v.extract input=markveggy.shp output=markveggy.1 new=13 \
where="(VEGTYPE = βWiβ) or (VEGTYPE = βPSβ) or (PRIME_TYPE=βWiβ)"
produces a new vector map with category number 13 if the SQL statement is fulfilled.
π Extract vector features which have the given field empty
v.extract input=lakes output=lakes_gaps where="FTYPE is NULL"
π Extract vector features which have the given field not empty
v.extract input=lakes output=lakes_ftype where="FTYPE not NULL"
π Reverse extracting (behaves like selective vector objects deleting)
remove meteorological stations from map which are located above 1000m:
# check what to delete:
v.db.select precip_30ynormals where="elev > 1000"
# perform reverse selection
v.extract -r input=precip_30ynormals output=precip_30ynormals_lowland \
where="elev > 1000"
# verify
v.db.select precip_30ynormals_lowland
π Dissolving based on column attributes
# check column names:
v.info -c zipcodes_wake
# reclass based on desired column:
v.reclass input=zipcodes_wake output=zipcodes_wake_recl_nam column=ZIPNAME
# verify:
v.info -c zipcodes_wake_recl_nam
v.db.select zipcodes_wake_recl_nam
# dissolve:
v.extract -d input=zipcodes_wake_recl_nam output=zipcodes_wake_regions
this produces a new vector map with common boundaries dissolved where the reclassed attributes of adjacent (left/right) areas are identical. π
π Extract 3 random areas from geology map
v.extract input=geology output=random_geology type=area random=3
this creates a new map with three random categories matching areas. note that there may be more than one feature with the same category. π
π SEE ALSO π
v.category, v.dissolve, v.reclass, GRASS SQL interface
π«Ά AUTHORS π«Ά
- R.L. Glenn, USDA, SCS, NHQ-CGIS
- GRASS 6 port by Radim Blazek
π» SOURCE CODE π»
available at: v.extract source code (history)
accessed: Saturday Jan 17 05:41:21 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 page, bestie. this was GRASS 8.4.2's v.extract(1), straight from the GRASS GIS User's Manual, and if you made it all the way down here you are lowkey a legend. go extract something cute. πβ¨π¦
π¦ 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