~ubuntu-branches/ubuntu/vivid/grass/vivid-proposed

« back to all changes in this revision

Viewing changes to vector/v.extract/v.extract.html

  • Committer: Package Import Robot
  • Author(s): Bas Couwenberg
  • Date: 2015-02-20 23:12:08 UTC
  • mfrom: (8.2.6 experimental)
  • Revision ID: package-import@ubuntu.com-20150220231208-1u6qvqm84v430b10
Tags: 7.0.0-1~exp1
* New upstream release.
* Update python-ctypes-ternary.patch to use if/else instead of and/or.
* Drop check4dev patch, rely on upstream check.
* Add build dependency on libpq-dev to grass-dev for libpq-fe.h.
* Drop patches applied upstream, refresh remaining patches.
* Update symlinks for images switched from jpg to png.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<h2>DESCRIPTION</h2>
 
2
 
 
3
<em>v.extract</em> allows a user to select vector objects from an existing 
 
4
vector map and creates a new map containing only the selected objects. 
 
5
Database tables can be queried with SQL statements, if a connection is
 
6
established. 
 
7
Dissolving (optional) is based on the output categories. If 2 adjacent
 
8
areas have the same output category, the boundary is removed.
 
9
 
 
10
<p>
 
11
If <b>cats</b>, <b>file</b>, <b>random</b> or <b>where</b> options are not
 
12
specified, all features of given type and layer are
 
13
extracted. Categories are not changed in that case.
 
14
 
 
15
<h2>NOTES</h2>
 
16
 
 
17
Only features with a category number will be extracted. So if you want to 
 
18
extract boundaries (which are usually without category, as that information
 
19
is normally held in the area's centroid) you must first use 
 
20
<em><a href="v.category.html">v.category</a></em> to add them.
 
21
 
 
22
<h2>EXAMPLES</h2>
 
23
 
 
24
The examples are intended for the North Carolina sample dataset:
 
25
 
 
26
<h3>Extract areas by category number with dissolving #1:</h3>
 
27
<div class="code"><pre>
 
28
v.extract -d cats=1,2,3,4 input=soils_wake output=soil_groupa type=area new=0
 
29
</pre></div>
 
30
 
 
31
<p>
 
32
produces a new vector <b>soil_groupa</b>, containing those areas from vector
 
33
<b>soils</b> which have category numbers <b>1 thru 4</b>; any common boundaries are
 
34
dissolved, and all areas in the new map will be assigned category number 0.
 
35
 
 
36
<h3>Extract areas by category number with dissolving #2:</h3>
 
37
<div class="code"><pre>
 
38
v.extract -d cats=1-4 input=soils_wake output=soil_groupa type=area new=-1
 
39
</pre></div>
 
40
<p>
 
41
produces a new vector map <b>soil_groupa</b> containing the areas from vector
 
42
<b>soils</b> which have categories <b>1 thru 4</b>. Any common boundaries are
 
43
dissolved, all areas in the new map will retain their original category
 
44
numbers 1 thru 4, since <b>new</b> was set to -1.
 
45
 
 
46
<h3>Extract all areas and assign the same category to all:</h3>
 
47
<div class="code"><pre>
 
48
v.extract input=soils_wake output=soil_groupa type=area new=1
 
49
</pre></div>
 
50
<p>
 
51
produces a new vector map <b>soil_groupa</b> containing all areas from
 
52
<b>soils</b>. No common boundaries are dissolved, all areas of the new
 
53
map will be assigned category number 1.
 
54
 
 
55
<h3>Extract vectors with SQL:</h3>
 
56
<div class="code"><pre>
 
57
v.extract input=markveggy.shp output=markveggy.1 new=13 \
 
58
  where="(VEGTYPE = 'Wi') or (VEGTYPE = 'PS') or (PRIME_TYPE='Wi')"
 
59
</pre></div>
 
60
<p>
 
61
produces a new vector map with category number 13 if the SQL statement is
 
62
fulfilled.
 
63
 
 
64
<h3>Extract vector features which have the given field empty:</h3>
 
65
<div class="code"><pre>
 
66
v.extract input=lakes output=lakes_gaps where="FTYPE is NULL"                    
 
67
</pre></div>
 
68
 
 
69
<h3>Extract vector features which have the given field not empty:</h3>
 
70
<div class="code"><pre>
 
71
v.extract input=lakes output=lakes_ftype where="FTYPE not NULL"
 
72
</pre></div>
 
73
 
 
74
<h3>Reverse extracting (behaves like selective vector objects deleting):</h3>
 
75
 
 
76
Remove meteorological stations from map which are located above 1000m:
 
77
<div class="code"><pre>
 
78
# check what to delete:
 
79
v.db.select precip_30ynormals where="elev &gt; 1000"
 
80
 
 
81
# perform reverse selection
 
82
v.extract -r input=precip_30ynormals output=precip_30ynormals_lowland \
 
83
  where="elev &gt; 1000"
 
84
 
 
85
# verify
 
86
v.db.select precip_30ynormals_lowland
 
87
</pre></div>
 
88
 
 
89
 
 
90
<h3>Dissolving based on column attributes:</h3>
 
91
<div class="code"><pre>
 
92
# check column names:
 
93
v.info -c zipcodes_wake
 
94
 
 
95
# reclass based on desired column:
 
96
v.reclass input=zipcodes_wake output=zipcodes_wake_recl_nam column=ZIPNAME
 
97
 
 
98
# verify:
 
99
v.info -c zipcodes_wake_recl_nam
 
100
v.db.select zipcodes_wake_recl_nam
 
101
 
 
102
# dissolve:
 
103
v.extract -d input=zipcodes_wake_recl_nam output=zipcodes_wake_regions
 
104
</pre></div>
 
105
<p>
 
106
This produces a new vector map with common boundaries dissolved where the reclassed
 
107
attributes of adjacent (left/right) areas are identical.
 
108
 
 
109
<h3>Remove islands from polygon map</h3>
 
110
<div class="code"><pre>
 
111
v.extract input=map_with_islands output=maps_without_islands cats=1-99999
 
112
# and/or
 
113
v.extract -d in=map_with_islands out=maps_without_islands
 
114
</pre></div>
 
115
 
 
116
<h3>Extract 3 random areas from geology map</h3>
 
117
<p>
 
118
<div class="code"><pre>
 
119
v.extract input=geology output=random_geology type=area random=3
 
120
</pre></div>
 
121
This creates a new map with three random categories matching areas.
 
122
Note that there may be more than one feature with the same category.
 
123
 
 
124
<h2>SEE ALSO</h2>
 
125
 
 
126
<em>
 
127
<a href="v.category.html">v.category</a>,
 
128
<a href="v.dissolve.html">v.dissolve</a>,
 
129
<a href="v.reclass.html">v.reclass</a>,
 
130
<a href="sql.html">GRASS SQL interface</a>
 
131
</em>
 
132
 
 
133
<h2>AUTHORS</h2>
 
134
 
 
135
R.L. Glenn, USDA, SCS, NHQ-CGIS<br>
 
136
GRASS 6 port by Radim Blazek
 
137
 
 
138
<p><i>Last changed: $Date: 2013-12-27 17:53:51 +0100 (Fri, 27 Dec 2013) $</i>