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