1v.extract(1) Grass User's Manual v.extract(1)
2
3
4
6 v.extract - Selects vector objects from an existing vector map and
7 creates a new map containing only the selected objects.
8 If 'list', 'file' and 'where' options are not specified, all features
9 of given type and layer are extracted. Categories are not changed in
10 that case.
11
13 vector
14
16 v.extract
17 v.extract help
18 v.extract [-dtr] input=name output=name [type=string[,string,...]]
19 [layer=integer] [new=integer] [list=range] [file=name]
20 [where=sql_query] [--overwrite] [--verbose] [--quiet]
21
22 Flags:
23 -d
24 Dissolve common boundaries (default is no)
25
26 -t
27 Do not copy table (see also 'new' parameter)
28
29 -r
30 Reverse selection
31
32 --overwrite
33 Allow output files to overwrite existing files
34
35 --verbose
36 Verbose module output
37
38 --quiet
39 Quiet module output
40
41 Parameters:
42 input=name
43 Name of input vector map
44
45 output=name
46 Name for output vector map
47
48 type=string[,string,...]
49 Type
50 Types to be extracted
51 Options: point,line,boundary,centroid,area,face
52 Default: point,line,boundary,centroid,area,face
53
54 layer=integer
55 Layer number
56 If -1, all features in all layers of given type are extracted
57 Default: 1
58
59 new=integer
60 Enter -1 to keep original categories or the desired NEW category
61 value
62 If new >= 0, table is not copied
63 Default: -1
64
65 list=range
66 Category values
67 Example: 1,3,7-9,13
68
69 file=name
70 Input text file with category numbers/number ranges to be extracted
71 If '-' given reads from standard input
72
73 where=sql_query
74 WHERE conditions of SQL statement without 'where' keyword
75 Example: income = 10000
76
78 v.extract allows a user to select vector objects from an existing vec‐
79 tor map and creates a new map containing only the selected objects.
80 Database tables can be queried with SQL statements, if a connection is
81 established. Dissolving (optional) is based on the output categories.
82 If 2 adjacent areas have the same output category, the boundary is
83 removed.
84
86 Only features with a category number will be extracted. So if you want
87 to extract boundaries (which are usually without category, as that
88 information is normally held in the area's centroid) you must first use
89 v.category to add them.
90
92 Extract areas by category number with dissolving #1:
93
94 v.extract -d list=1,2,3,4 input=soils output=soil_groupa type=area
95 new=0
96
97
98 produces a new vector soil_groupa, containing those areas from vector
99 soils which have category numbers 1 thru 4; any common boundaries are
100 dissolved, and all areas in the new map will be assigned category num‐
101 ber 0.
102
103 Extract areas by category number with dissolving #2:
104
105 v.extract -d list=1-4 input=soils output=soil_groupa type=area new=-1
106
107
108 produces a new vector map soil_groupa containing the areas from vector
109 soils which have categories 1 thru 4. Any common boundaries are dis‐
110 solved, all areas in the new map will retain their original category
111 numbers 1 thru 4, since new was set to -1.
112
113 Extract all areas and assign the same category to all:
114
115 v.extract input=soils output=soil_groupa type=area new=1
116
117
118 produces a new vector map soil_groupa containing all areas from soils.
119 No common boundaries are dissolved, all areas of the new map will be
120 assigned category number 1.
121
122 Extract vectors with SQL:
123
124 v.extract input=markveggy.shp output=markveggy.1 new=13 where="(VEGTYPE
125 = 'Wi') or (VEGTYPE = 'PS') or (PRIME_TYPE='Wi')"
126
127
128 produces a new vector map with category number 13 if the SQL statement
129 is fulfilled.
130
131 Extract vector features which have the given field empty:
132
133 v.extract input=forest output=forest_gaps where="CANOPY is NULL"
134
135
136 Extract vector features which have the given field not empty:
137
138 v.extract input=forest output=forest_canopy where="CANOPY not NULL"
139
140
141 Reverse extracting (behaves like selective vector objects deleting):
142 Remove unreferenced stations from the GlobalSOD database:
143 # check what to delete:
144 v.db.select gsod_stationlist where="latitude < -91"
145 # perform reverse selection
146 v.extract -r gsod_stationlist out=gsod_stationlist_clean where="lati‐
147 tude < -91"
148 v.db.select gsod_stationlist_clean
149
150
151 Dissolving based on column attributes:
152
153 # check column names:
154 v.info -c polbnda_italy
155 # reclass based on desired column:
156 v.reclass polbnda_italy out=polbnda_italy_recl_nam col=vmap_nam
157 # verify:
158 v.info -c polbnda_italy_recl_nam
159 v.db.select polbnda_italy_recl_nam
160 # dissolve:
161 v.extract -d polbnda_italy_recl_nam out=pol_italy_regions
162
163
164 produces a new vector map with common boundaries dissolved where the
165 reclassed attributes of adjacent (left/right) areas are identical.
166
167 Remove islands from polygon map
168
169 v.extract in=map_with_islands out=maps_without_islands list=1-99999
170 # and/or
171 v.extract -d in=map_with_islands out=maps_without_islands
172
173
175 v.category, v.dissolve, v.reclass, GRASS SQL interface
176
178 R.L. Glenn, USDA, SCS, NHQ-CGIS
179 GRASS 6 port by Radim Blazek
180
181 Last changed: $Date: 2007-05-17 11:08:04 +0200 (Thu, 17 May 2007) $
182
183 Full index
184
185 © 2003-2008 GRASS Development Team
186
187
188
189GRASS 6.3.0 v.extract(1)