~ubuntu-branches/ubuntu/wily/grass/wily

« back to all changes in this revision

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

Tags: 7.0.0~rc1+ds1-1~exp1
* New upstream release candidate.
* Repack upstream tarball, remove precompiled Python objects.
* Add upstream metadata.
* Update gbp.conf and Vcs-Git URL to use the experimental branch.
* Update watch file for GRASS 7.0.
* Drop build dependencies for Tcl/Tk, add build dependencies:
  python-numpy, libnetcdf-dev, netcdf-bin, libblas-dev, liblapack-dev
* Update Vcs-Browser URL to use cgit instead of gitweb.
* Update paths to use grass70.
* Add configure options: --with-netcdf, --with-blas, --with-lapack,
  remove --with-tcltk-includes.
* Update patches for GRASS 7.
* Update copyright file, changes:
  - Update copyright years
  - Group files by license
  - Remove unused license sections
* Add patches for various typos.
* Fix desktop file with patch instead of d/rules.
* Use minimal dh rules.
* Bump Standards-Version to 3.9.6, no changes.
* Use dpkg-maintscript-helper to replace directories with symlinks.
  (closes: #776349)
* Update my email to use @debian.org address.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<h2>DESCRIPTION</h2>
 
2
 
 
3
<em>v.overlay</em> allows the user to overlay two vector maps. Features 
 
4
in <b>ainput</b> can be lines or areas and are cut with areas in 
 
5
<b>binput</b>. Simple <i>clipping</i> can be performed with the <b>and</b> 
 
6
operator.
 
7
<p>
 
8
If areas in <b>ainput</b> are overlaid with areas in <b>binput</b>, 
 
9
it is sometimes necessary to snap areas of <b>binput</b> to those of 
 
10
<b>ainput</b>, otherwise areas can go missing or many sliver areas 
 
11
can be created. Snapping is enabled by default and can be disabled by 
 
12
setting the <b>snap</b> option to a negative value. Recommended values 
 
13
are between 0.00000001 and 0.0001. Using larger values for snapping can 
 
14
have undesired side-effects, but may sometimes be necessary to get a 
 
15
clean output (see example below). In general, it is recommended to start 
 
16
with a small snapping threshold, gradually increasing the threshold until 
 
17
the result is reasonably clean. Snapping modifies only boundaries in 
 
18
binput, which are snapped to boundaries in ainput. Boundaries in <b>ainput</b> 
 
19
are not modified.
 
20
<!-- This is outdated 
 
21
There are 3 links attached to features in output map, 
 
22
<ul>
 
23
<li><b>field 1</b>: link to the new table, new table has 3 columns
 
24
    <ul>
 
25
        <li><b>cat</b> - key column linking rows to features
 
26
        <li><b>cata</b> - category of <i>afield</i> from <i>ainput</i>
 
27
        <li><b>catb</b> - category of <i>bfield</i> from <i>binput</i>
 
28
    </ul>
 
29
<li><b>field 2</b>: category of <i>afield</i> from <i>ainput</i>
 
30
<li><b>field 3</b>: category of <i>bfield</i> from <i>binput</i>
 
31
</ul>
 
32
-->
 
33
<p>
 
34
If the <i>first</i> number of the <b>olayer</b> option is greater than 0, then the 
 
35
resulting output map has a merged attribute table in the given layer 
 
36
number. The original column names have a prefix (<em>a_</em> and 
 
37
<em>b_</em>) corresponding to <b>ainput</b> and <b>binput</b> map.
 
38
<p>
 
39
If the <i>second</i> number of the <b>olayer</b> option is greater than 0, then the 
 
40
categories of <b>ainput</b> in layer <b>alayer</b> are transferred to
 
41
the output layer with the second number.
 
42
<p>
 
43
If the <i>third</i> number of the <b>olayer</b> option is greater than 0, then the 
 
44
categories of <b>binput</b> in layer <em>blayer</em> are transferred to
 
45
the output layer with the third number.
 
46
 
 
47
<h2>NOTES</h2>
 
48
Currently only areas in <b>ainput</b> are supported for the operators 
 
49
<em>or</em> and <em>xor</em>! See also <em><a href="v.select.html">v.select</a></em>.
 
50
 
 
51
The operator defines what kind of operation will be done. Features are 
 
52
written to output, if the result of an operation <b>ainput</b> operator <b>binput</b> 
 
53
is true.
 
54
<p>
 
55
If the <i>first</i> number of the <b>olayer</b> option is greater than 0, then attributes 
 
56
of the tables from <b>ainput</b> and <b>binput</b> are joined into a new table linked 
 
57
to the output map with a new cat column. 
 
58
<p>
 
59
If the <i>second</i> number of the <b>olayer</b> option is greater than 0, then the 
 
60
attribute table of <b>ainput</b> is copied to the output map. 
 
61
<p>
 
62
If the <i>third</i> number of the <b>olayer</b> option is greater than 0, then the 
 
63
attribute table of <b>binput</b> is copied to the output map. 
 
64
 
 
65
<p>
 
66
If <b>atype</b>=auto is given than <em>v.overlay</em> determines
 
67
feature type for <b>ainput</b> from the first found feature.
 
68
 
 
69
<!-- This is outdated
 
70
<p><div class="code"><pre>
 
71
v.db.connect map=outputmap table=ainput.dbf field=2
 
72
v.db.connect map=outputmap table=binput.dbf field=3
 
73
 
 
74
</pre></div>
 
75
 
 
76
<p><b>Attention:</b> Removing the output map will also delete all tables linked to
 
77
it! Therefore it is advisable to copy tables from ainput and binput first and
 
78
connect the copied tables to the output map.-->
 
79
 
 
80
<h2>EXAMPLES</h2>
 
81
 
 
82
<h3>Overlay operations: AND, OR, NOT, XOR</h3>
 
83
 
 
84
Examples based on North Carolina sample dataset:
 
85
 
 
86
<div class="code"><pre>
 
87
# creation of simple dataset
 
88
v.extract input=zipcodes_wake output=poly1 where="cat = 42"
 
89
v.extract input=urbanarea output=poly2 where="cat = 55"
 
90
 
 
91
v.overlay ainput=poly1 binput=poly2 operator=and output=poly_1_2_and
 
92
v.overlay ainput=poly1 binput=poly2 operator=or  output=poly_1_2_or
 
93
v.overlay ainput=poly1 binput=poly2 operator=not output=poly_1_2_not
 
94
v.overlay ainput=poly1 binput=poly2 operator=xor output=poly_1_2_xor
 
95
</pre></div>
 
96
 
 
97
<center>
 
98
<img src="v_overlay_poly_1_2.png" alt="GRASS v.overlay: input polygons (1 and 2)" border=0>
 
99
<br>
 
100
<i>v.overlay operations: original input polygons</i>
 
101
</center>
 
102
<p>
 
103
<center>
 
104
<img src="v_overlay_poly_1_2_a_o_n_x.png" alt="GRASS v.overlay results: AND, OR, NOT, XOR operations" border=0>
 
105
<br>
 
106
<i>v.overlay results of AND, OR, NOT, XOR operations</i>
 
107
</center>
 
108
 
 
109
 
 
110
<h3>Polygons overlaid with polygons</h3>
 
111
<div class="code"><pre>
 
112
v.overlay ainput=lake binput=province output=lakeXprovince operator=or
 
113
</pre></div>
 
114
 
 
115
Polygon union of urban area and Census 2000 areas (North Carolina dataset):
 
116
 
 
117
<div class="code"><pre>
 
118
# input maps
 
119
d.vect urbanarea
 
120
d.vect census_wake2000
 
121
 
 
122
# union
 
123
v.overlay ain=census_wake2000 bin=urbanarea out=urban_census2000 operator=or
 
124
 
 
125
# show result, graphically zooming a subset
 
126
g.region n=230400 s=223800 w=655800 e=662400
 
127
d.erase
 
128
d.vect urban_census2000
 
129
 
 
130
# show merged attribute table
 
131
v.db.select urban_census2000 where="cat=108" -v
 
132
cat|108
 
133
a_cat|98
 
134
a_AREA|231001264
 
135
a_PERIMETE|67804.305
 
136
a_TRACT_|98
 
137
a_TRACT_ID|98
 
138
a_RINGS_OK|1
 
139
a_RINGS_NO|0
 
140
a_ID|98
 
141
a_FIPSSTCO|37183
 
142
a_TRT2000|054108
 
143
a_STFID|37183054108
 
144
a_TRACTID|541.08
 
145
a_TRACT|541.08
 
146
b_cat|55
 
147
b_OBJECTID|55
 
148
b_UA|73261
 
149
b_NAME|Raleigh
 
150
b_UA_TYPE|UA
 
151
</pre></div>
 
152
 
 
153
<center>
 
154
<img src="v_overlay_urbanarea.png" alt="GRASS v.overlay: polygon to polygon union (input 1)" border=1>
 
155
<img src="v_overlay_census_wake2000.png" alt="GRASS v.overlay: polygon to polygon union (input 2)" border=1>
 
156
<img src="v_overlay_urban_census2000.png" alt="GRASS v.overlay: polygon to polygon union (result)" border=1>
 
157
<br>
 
158
<i>v.overlay: Polygon union (right) of urban area (left) and Census 2000 (middle) areas (North Carolina dataset)</i>
 
159
</center>
 
160
 
 
161
<p>
 
162
As can be seen by the resulting large number of centroids on boundaries, 
 
163
the urban areas do not match exactly the Census 2000 areas. In this case 
 
164
a clean result can be obtained by snapping with a threshold of 0.1 m.
 
165
 
 
166
<h3>Lines overlaid with polygons</h3>
 
167
 
 
168
Using the North Carolina sample dataset, we clip the roads map to the area
 
169
of city of Raleigh, preserving road attributes in layer 1:
 
170
<div class="code"><pre>
 
171
g.region vector=zipcodes_wake
 
172
 
 
173
# extract Raleigh city:
 
174
v.extract in=zipcodes_wake out=raleigh \
 
175
            where="ZIPNAME = 'RALEIGH'"
 
176
 
 
177
# clip road network to city polygon:
 
178
v.overlay ainput=roadsmajor atype=line binput=raleigh \
 
179
            out=roadsmajor_raleigh operator=and \
 
180
            olayer=0,1,0
 
181
</pre></div>
 
182
 
 
183
<center>
 
184
<img src="v_overlay_area_lines.png" alt="GRASS v.overlay: Line to polygon clipping"><br>
 
185
<table border=0 width=590>
 
186
<tr><td><center>
 
187
<i>v.overlay: Line to polygon clipping</i>
 
188
</center></td></tr>
 
189
</table>
 
190
</center>
 
191
 
 
192
 
 
193
<h2>SEE ALSO</h2>
 
194
 
 
195
<em>
 
196
<a href="v.db.connect.html">v.db.connect</a>,
 
197
<a href="v.select.html">v.select</a>,
 
198
<a href="g.copy.html">g.copy</a>
 
199
</em>
 
200
 
 
201
<h2>AUTHORS</h2>
 
202
 
 
203
Radim Blazek, ITC-Irst, Trento, Italy<br>
 
204
Markus Metz
 
205
 
 
206
<p>
 
207
<i>Last changed: $Date: 2014-12-19 22:55:37 +0100 (Fri, 19 Dec 2014) $</i>