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. If 'list',
8 'file' and 'where' options are not specified, all features of given
9 type and layer are extracted, categories are not changed in that case.
10
12 vector
13
15 v.extract
16 v.extract help
17 v.extract [-dt] input=name output=name [type=string[,string,...]]
18 [layer=integer] [new=integer] [list=range[,range,...]]
19 [file=string] [where=sql_query] [--overwrite]
20
21 Flags:
22 -d Dissolve common boundaries (default is no)
23
24 -t Do not copy table (see also 'new' parameter)
25
26 --overwrite
27
28 Parameters:
29 input=name
30 Name of input vector map
31
32 output=name
33 Name for output vector map
34
35 type=string[,string,...]
36 Types to be extracted Options: point,line,boundary,cen‐
37 troid,area,face Default: point,line,boundary,centroid,area,face
38
39 layer=integer
40 Layer number. If -1, all features in all layers of given type are
41 extracted. Default: 1
42
43 new=integer
44 Enter -1 to keep original categories or the desired NEW category
45 value. If new >= 0, table is not copied. Default: -1
46
47 list=range[,range,...]
48 Category ranges: e.g. 1,3-8,13
49
50 file=string
51 Input text file with category numbers/number ranges to be extracted
52
53 where=sql_query
54 WHERE conditions of SQL statement without 'where' keyword. (exam‐
55 ple: income = 10000)
56
58 v.extract allows a user to select vector objects from an existing vec‐
59 tor map and creates a new map containing only the selected objects.
60 Database tables can be queried with SQL statements, if a connection is
61 established. Dissolving (optional) is based on the output categories.
62 If 2 adjacent areas have the same output category, the boundary is
63 removed.
64
66 Only features with a category number will be extracted. So if you want
67 to extract boundaries (which are usually without category, as that
68 information is normally held in the area's centroid) you must first use
69 v.category to add them.
70
72 Extract areas by category number with dissolving #1:
73
74 v.extract -d list=1,2,3,4 input=soils output=soil_groupa type=area
75 new=0
76
77
78 produces a new vector soil_groupa, containing those areas from vector
79 soils which have category numbers 1 thru 4; any common boundaries are
80 dissolved, and all areas in the new map will be assigned category num‐
81 ber 0.
82
83 Extract areas by category number with dissolving #2:
84
85 v.extract -d list=1-4 input=soils output=soil_groupa type=area new=-1
86
87
88 produces a new vector map soil_groupa containing the areas from vector
89 soils which have categories 1 thru 4. Any common boundaries are dis‐
90 solved, all areas in the new map will retain their original category
91 numbers 1 thru 4, since new was set to -1.
92
93 Extract all areas and assign the same category to all:
94
95 v.extract input=soils output=soil_groupa type=area new=1
96
97
98 produces a new vector map soil_groupa containing all areas from soils.
99 No common boundaries are dissolved, all areas of the new map will be
100 assigned category number 1.
101
102 Extract vectors with SQL:
103
104 v.extract input=markveggy.shp output=markveggy.1 new=13 where="(VEGTYPE
105 = 'Wi') or (VEGTYPE = 'PS') or (PRIME_TYPE='Wi')"
106
107
108 produces a new vector map with category number 13 if the SQL statement
109 is fulfilled.
110
111 Extract vector features which have the given field empty:
112
113 v.extract input=forest output=forest_gaps where="CANOPY is NULL"
114
115
116 Extract vector features which have the given field not empty:
117
118 v.extract input=forest output=forest_canopy where="CANOPY not NULL"
119
120
121 Dissolving based on column attributes:
122
123 # check column names:
124 v.info -c polbnda_italy
125 # reclass based on desired column:
126 v.reclass polbnda_italy out=polbnda_italy_recl_nam col=vmap_nam
127 # verify:
128 v.info -c polbnda_italy_recl_nam
129 v.db.select polbnda_italy_recl_nam
130 # dissolve:
131 v.extract -d polbnda_italy_recl_nam out=pol_italy_regions
132
133
134 produces a new vector map with common boundaries dissolved where the
135 reclassed attributes of adjacent (left/right) areas are identical.
136
137 Remove islands from polygon map
138
139 v.extract in=map_with_islands out=maps_without_islands list=1-99999
140 # and/or
141 v.extract -d in=map_with_islands out=maps_without_islands
142
143
145 v.category, v.reclass, GRASS SQL interface
146
148 R.L. Glenn, USDA, SCS, NHQ-CGIS
149
150 Last changed: $Date: 2006/10/31 19:16:26 $
151
152 Full index
153
154
155
156GRASS 6.2.2 v.extract(1)