1v.extract(1)                GRASS GIS User's Manual               v.extract(1)
2
3
4

NAME

6       v.extract   -  Selects  vector features from an existing vector map and
7       creates a new vector map containing only the selected features.
8

KEYWORDS

10       vector, extract, select, dissolve, random
11

SYNOPSIS

13       v.extract
14       v.extract --help
15       v.extract          [-dtr]          input=name            [layer=string]
16       [type=string[,string,...]]     [cats=range]    [where=sql_query]   out‐
17       put=name   [file=name]     [random=integer]     [new=integer]     [dis‐
18       solve_column=name]    [--overwrite]   [--help]   [--verbose]  [--quiet]
19       [--ui]
20
21   Flags:
22       -d
23           Dissolve common boundaries (default is no)
24
25       -t
26           Do not copy attributes (see also ’new’ parameter)
27
28       -r
29           Reverse selection
30
31       --overwrite
32           Allow output files to overwrite existing files
33
34       --help
35           Print usage summary
36
37       --verbose
38           Verbose module output
39
40       --quiet
41           Quiet module output
42
43       --ui
44           Force launching GUI dialog
45
46   Parameters:
47       input=name [required]
48           Name of input vector map
49           Or data source for direct OGR access
50
51       layer=string
52           Layer number or name (’-1’ for all layers)
53           A single vector map can be connected to multiple  database  tables.
54           This  number  determines  which table to use. When used with direct
55           OGR access this is the layer name.
56           Default: 1
57
58       type=string[,string,...]
59           Types to be extracted
60           Input feature type
61           Options: point, line, boundary, centroid, area, face
62           Default: point,line,boundary,centroid,area,face
63
64       cats=range
65           Category values
66           Example: 1,3,7-9,13
67
68       where=sql_query
69           WHERE conditions of SQL statement without ’where’ keyword
70           Example: income < 1000 and population >= 10000
71
72       output=name [required]
73           Name for output vector map
74
75       file=name
76           Input text file with category numbers/number ranges to be extracted
77           If ’-’ given reads from standard input
78
79       random=integer
80           Number of random categories matching vector objects to extract
81           Number must be smaller than unique cat count in layer
82
83       new=integer
84           Desired new category value (enter -1 to keep original categories)
85           If new >= 0, attributes is not copied
86           Default: -1
87
88       dissolve_column=name
89           Name of attribute column for dissolving areas
90           Preserves category values
91

DESCRIPTION

93       v.extract allows a user to select vector objects from an existing  vec‐
94       tor  map  and  creates  a new map containing only the selected objects.
95       Database tables can be queried with SQL statements, if a connection  is
96       established.   Dissolving (optional) is based on the output categories.
97       If 2 adjacent areas have the same output category, the boundary is  re‐
98       moved.
99
100       If  cats, file, random or where options are not specified, all features
101       of given type and layer are extracted. Categories are  not  changed  in
102       that case.
103

NOTES

105       Only  features with a category number in the selected layer will be ex‐
106       tracted. So if you want to extract boundaries (which are usually  with‐
107       out  category,  as that information is normally held in the area’s cen‐
108       troid) you must first use v.category to add them, or use layer=-1.
109

EXAMPLES

111       The examples are intended for the North Carolina sample dataset:
112
113   Extract areas by category number with dissolving #1:
114       v.extract -d cats=1,2,3,4 input=soils_wake output=soil_groupa type=area new=0
115
116       produces a new vector soil_groupa, containing those areas  from  vector
117       soils  which  have category numbers 1 thru 4; any common boundaries are
118       dissolved, and all areas in the new map will be assigned category  num‐
119       ber 0.
120
121   Extract areas by category number with dissolving #2:
122       v.extract -d cats=1-4 input=soils_wake output=soil_groupa type=area new=-1
123
124       produces  a new vector map soil_groupa containing the areas from vector
125       soils which have categories 1 thru 4. Any common  boundaries  are  dis‐
126       solved,  all  areas  in the new map will retain their original category
127       numbers 1 thru 4, since new was set to -1.
128
129   Extract all areas and assign the same category to all:
130       v.extract input=soils_wake output=soil_groupa type=area new=1
131
132       produces a new vector map soil_groupa containing all areas from  soils.
133       No  common  boundaries  are dissolved, all areas of the new map will be
134       assigned category number 1.
135
136   Extract vectors with SQL:
137       v.extract input=markveggy.shp output=markveggy.1 new=13 \
138         where="(VEGTYPE = ’Wi’) or (VEGTYPE = ’PS’) or (PRIME_TYPE=’Wi’)"
139
140       produces a new vector map with category number 13 if the SQL  statement
141       is fulfilled.
142
143   Extract vector features which have the given field empty:
144       v.extract input=lakes output=lakes_gaps where="FTYPE is NULL"
145
146   Extract vector features which have the given field not empty:
147       v.extract input=lakes output=lakes_ftype where="FTYPE not NULL"
148
149   Reverse extracting (behaves like selective vector objects deleting):
150       Remove meteorological stations from map which are located above 1000m:
151       # check what to delete:
152       v.db.select precip_30ynormals where="elev > 1000"
153       # perform reverse selection
154       v.extract -r input=precip_30ynormals output=precip_30ynormals_lowland \
155         where="elev > 1000"
156       # verify
157       v.db.select precip_30ynormals_lowland
158
159   Dissolving based on column attributes:
160       # check column names:
161       v.info -c zipcodes_wake
162       # reclass based on desired column:
163       v.reclass input=zipcodes_wake output=zipcodes_wake_recl_nam column=ZIPNAME
164       # verify:
165       v.info -c zipcodes_wake_recl_nam
166       v.db.select zipcodes_wake_recl_nam
167       # dissolve:
168       v.extract -d input=zipcodes_wake_recl_nam output=zipcodes_wake_regions
169
170       This  produces  a new vector map with common boundaries dissolved where
171       the reclassed attributes of adjacent (left/right) areas are identical.
172
173   Extract 3 random areas from geology map
174       v.extract input=geology output=random_geology type=area random=3
175       This creates a new map with three  random  categories  matching  areas.
176       Note that there may be more than one feature with the same category.
177

SEE ALSO

179        v.category, v.dissolve, v.reclass, GRASS SQL interface
180

AUTHORS

182       R.L. Glenn, USDA, SCS, NHQ-CGIS
183       GRASS 6 port by Radim Blazek
184

SOURCE CODE

186       Available at: v.extract source code (history)
187
188       Accessed: Saturday Oct 28 18:18:30 2023
189
190       Main  index  | Vector index | Topics index | Keywords index | Graphical
191       index | Full index
192
193       © 2003-2023 GRASS Development Team, GRASS GIS 8.3.1 Reference Manual
194
195
196
197GRASS 8.3.1                                                       v.extract(1)
Impressum