Debian Codegraph @

vector/v.edit/v.edit.html

raw
1 <h2>DESCRIPTION</h2>
2
3 The module <em>v.edit</em> allows the user to edit a vector map
4 via command line interface.
5
6 <p><em>v.edit</em> supports only "simple" vector features: points,
7 centroids, lines and boundaries. Currently, only 2D vector features
8 (except of <b>tool=zbulk</b>) are supported.
9
10 <p>Provides editing features' geometry. Attribute data connected to the
11 vector map are not modified at all.
12
13 <p>Vector features can be selected either by internal <b>id</b>, category
14 number <b>cats</b>, coordinates <b>coords</b>, bounding
15 box <b>bbox</b>, <b>polygon</b>, <b>where</b> statement (attribute
16 data) or by <b>query</b>. Selecting features by coordinates is
17 affected by the current 2D resolution or by the threshold distance
18 given by <b>threshold</b>. The options are <em>orthogonal</em>, i.e. can
19 be used in various combinations. For example:
20
21 <div class="code"><pre>
22 v.edit map=roads tool=select \
23 coord=599505,4921010,603389.0625,4918292.1875 \
24 threshold=10000 where="label='interstate'"
25 </pre></div>
26
27 selects all features (and prints their id's to standard output)
28 covered by two bounding boxes (center at 599505,4921010 and
29 603389.0625,4918292.1875, size 2*10000) with attribute
30 <code>label='interstate'</code>.
31
32 <h2>NOTES</h2>
33
34 If no vector features are selected or the flag <b>-b</b> is
35 used, topology is not build at the end.
36
37 <h2>USAGE</h2>
38
39 <h3>Feature selection</h3>
40
41 Vector features can be selected in several ways:
42 <ul>
43 <li><b>ids</b> - using internal (unique) feature id's</li>
44 <li><b>cats</b> - using category numbers</li>
45 <li><b>coords</b> - using x,y coordinate pairs (center of bounding
46 box, size defined by <b>threshold</b>)</li>
47 <li><b>bbox</b> - using bounding box</li>
48 <li><b>polygon</b> - using polygon (at least 3 coordinate pairs have to be set)</li>
49 <li><b>where</b> - using where statement (attribute data)</li>
50 <li><b>query</b> - special query (e.g. minimal vector line length)</li>
51 </ul>
52
53 Additional parameters for vector feature specification are:
54 <ul>
55 <li><b>layer</b> - layer number (currently used only
56 with <b>cats</b> or <b>where</b> option)</li>
57 <li><b>threshold</b> - threshold distance used for selecting vector
58 features by coordinates</li>
59 </ul>
60
61 <h3>Tool description</h3>
62
63 <ul>
64 <li><b>create</b> - Create new (empty) vector map (see
65 also <em><a href="v.in.ascii.html">v.in.ascii</a></em>). Optionally
66 vector features (in <a href="vectorascii.html">GRASS ASCII vector
67 format</a>) can be read from standard input (<b>input=-</b>) or
68 from the text file given by the <b>input</b> option.</li>
69
70 <li><b>add</b> - Add new vector features (defined
71 in <a href="vectorascii.html">GRASS ASCII vector format</a>) to
72 existing vector map. Features can be read from standard input or
73 from the given text file (<b>input</b> option). If no header is
74 given, the <b>-n</b> flag must be used. Added features can be
75 snapped (defined by <b>snap</b> parameter) to nodes or vertices
76 based on threshold distance <b>threshold</b>.</li>
77
78 <li><b>delete</b> - Delete selected vector features from existing
79 vector map.</li>
80
81 <li><b>copy</b> - Make identical copy of selected vector
82 features. If background map <b>bgmap</b> is given copy features
83 from background map, not from currently modified vector map.</li>
84
85 <li><b>move</b> - Move selected features of existing vector map
86 relatively to their current location. This tool requires
87 <b>move</b> option. The option defines coordinates of the movement
88 direction. Moved features can be snapped (defined by <b>snap</b>
89 parameter) to nodes or vertices based on threshold
90 distance <b>threshold</b>.</li>
91
92 <li><b>flip</b> - Flip direction of selected vector lines
93 (lines or boundaries).</li>
94
95 <li><b>catadd</b> - Add new layer category(ies) to selected vector
96 feature(s). Category can be later used for new database
97 entry.</li>
98
99 <li><b>catdel</b> - Delete layer category(ies) of selected vector
100 feature(s).</li>
101
102 <li><b>merge</b> - Merge (at least two) selected vector lines or
103 boundaries. The geometry of the merged vector lines can be
104 changed. If the second line from two selected lines is in opposite
105 direction to the first, it will be flipped. See also
106 module <em><a href="v.build.polylines.html">v.build.polylines</a></em>.</li>
107
108 <li><b>break</b> - Split given vector line or boundary into two
109 lines on location given by <b>coords</b>. If <b>coords</b> not
110 given, breaks all selected lines at each intersection (based
111 on <em><a href="v.clean.html">v.clean</a></em>, <code>tool=break</code>).</li>
112
113 <li><b>snap</b> - Snap vector features in given threshold. See
114 also module <em><a href="v.clean.html">v.clean</a></em>. Note that this
115 tool supports only snapping to nodes. Parameters <b>snap</b> and
116 <b>bgmap</b> are ignored.</li>
117
118 <li><b>connect</b> - Connect selected lines or boundaries, the
119 first given line is connected to the second one. The second line
120 is broken if necessary. The lines are connected only if distance
121 between them is not greater than snapping threshold
122 distance <b>threshold</b>.</li>
123
124 <li><b>extend</b> - Extend selected lines or boundaries without changing
125 the current shape. Similar to <b>connect</b>, but the first and second
126 lines are both extended until they intersect. The second line is broken if
127 necessary. The lines are extended only if distance between them is not
128 greater than snapping threshold distance <b>threshold</b>. If the first and
129 second lines are parallel and do not intersect, no lines are extended. Use
130 the <b>-p</b> flag to extend the first line across the parallel gap.</li>
131
132 <li><b>extendstart</b> - Similar to <b>extend</b>, but extend at start
133 nodes only. Start nodes are used to select the second line and the end node
134 of that line can also be extended if it is within the snapping threshold
135 distance given by <b>threshold</b>.</li>
136
137 <li><b>extendend</b> - Similar to <b>extend</b>, but extend at end nodes
138 only.</li>
139
140 <li><b>chtype</b> - Change feature type of selected geometry
141 objects. Points are converted to centroids, centroids to points,
142 lines to boundaries and boundaries to lines.</li>
143
144 <li><b>vertexadd</b> - Add vertex(ces) to the given vector lines
145 or boundaries. Location of the new vertex is given by <b>coord</b>
146 option. If -1 is given only first found line or boundary in bounding
147 box is modified.</li>
148
149 <li><b>vertexdel</b> - Remove vertex(ces) specified by
150 <b>coords</b> option. If -1 is given only first found line or
151 boundary in bounding box is modified.</li>
152
153 <li><b>vertexmove</b> - Move vertex(ces) specified
154 by <b>coords</b> option. Direction of the movement is specified by
155 the <b>move</b> option. If -1 is given only first found
156 line or boundary in bounding box is modified. Moved vertex can be
157 snapped (defined <b>snap</b>) to nodes or vertices based on
158 threshold distance <b>threshold</b>.</li>
159
160 <li><b>zbulk</b> - Assign z coordinate to 3D vector lines in given
161 bounding box. The first found line will get z coordinate based on
162 value given by <b>zbulk</b> parameter. Z coordinate of other
163 selected lines will be increased by step given by <b>zbulk</b>
164 parameter. This tool strictly requires <b>bbox</b>
165 and <b>zbulk</b> parameter. Also input vector map must be 3D.</li>
166
167 <li><b>select</b> - Print comma separated list of selected line
168 id's. No editing is done.</li>
169 </ul>
170
171 <h2>EXAMPLES</h2>
172
173 <h3>Create new vector map</h3>
174
175 Create new (empty) vector map:
176
177 <div class="code"><pre>
178 v.edit tool=create map=vectmap
179 </pre></div>
180
181 Create new vector map and read data from file 'roads.txt':
182
183 <div class="code"><pre>
184 v.out.ascii in=roads format=standard &gt; roads.txt;
185 v.edit tool=create map=vectmap input=roads.txt
186 </pre></div>
187
188 or alternatively
189
190 <div class="code"><pre>
191 cat roads.txt | v.edit tool=create map=vectmap input=-
192 </pre></div>
193
194 <h3>Add new features to existing vector map</h3>
195
196 Add a new point to the vector map (without header):
197
198 <div class="code"><pre>
199 echo "P 1 1
200 640794 214874
201 1 1" | v.edit -n tool=add map=vectmap input=-
202
203 # insert new row for each category in attribute table if doesn't exist yet
204 v.to.db map=vectmap option=cat
205 </pre></div>
206
207 The input must be in <a href="vectorascii.html">GRASS ASCII vector
208 format</a>.
209
210 <p>
211 Add new features read from standard input:
212
213 <div class="code"><pre>
214 v.out.ascii in=railroads format=standard | v.edit tool=add map=vectmap input=-
215 </pre></div>
216
217 <h3>Delete selected features from vector map layer</h3>
218
219 Remove all vector features with category number 1 or 2:
220
221 <div class="code"><pre>
222 v.edit tool=delete map=roads cats=1,2
223 </pre></div>
224
225 Remove all vector features except of those with category number 1 or 2
226 (reverse selection):
227
228 <div class="code"><pre>
229 v.edit -r tool=delete map=roads cats=1,2
230 </pre></div>
231
232 Remove features with category 1 or 2 located on coordinates
233 600952.625,4926107 (bounding box based on the current 2D resolution):
234
235 <div class="code"><pre>
236 g.region -d;
237 v.edit tool=delete map=roads cats=1,2 coords=600952.625,4926107
238 </pre></div>
239
240 Remove all features with category 1 and 2 covered by two bounding boxes
241 (center coordinates 592542.892,4924766.996 and 603389.062,4918292.187,
242 size 1000 map units):
243
244 <div class="code"><pre>
245 v.edit map=roads tool=delete \
246 coord=592542.892,4924766.996,603389.062,4918292.187 \
247 threshold=1000 cat=1,2
248 </pre></div>
249
250 <h3>Copy selected features from background map</h3>
251
252 Copy all features with category number 1 from background map:
253
254 <div class="code"><pre>
255 v.edit map=roads tool=copy bgmap=archsites cat=1
256 </pre></div>
257
258 <h3>Move features</h3>
259
260 Move feature (vector point) located on coordinates 602580,4918480 to
261 coordinates 603580,4919480:
262
263 <div class="code"><pre>
264 v.edit tool=move map=archsites coord=602580,4918480 th=1e-2 move=1000,1000
265 </pre></div>
266
267 Move all features with category 1 1000 map units to the west and 1000
268 map units to the south. Moved features snap to nodes in threshold
269 distance 10 map units:
270
271 <div class="code"><pre>
272 v.edit tool=move map=roads cat=1 move=1000,-1000 snap=node threshold=-1,10
273 </pre></div>
274
275 Move all features defined by bounding box
276 601530,4921560,602520,4922310 (W,S,E,N) 1000 map units to the
277 east and 1000 map units to the north:
278
279 <div class="code"><pre>
280 v.edit tool=move map=roads bbox=601530,4921560,602520,4922310 move=-1000,1000
281 </pre></div>
282
283 <h3>Flip direction of vector lines</h3>
284
285 Flip direction of all vector lines:
286
287 <div class="code"><pre>
288 v.edit tool=flip map=streams cats=1-9999 type=line
289 </pre></div>
290
291 <h3>Add / delete layer category number</h3>
292
293 Add new layer/category 2/1, 2/3, 2/4, 2/5 to features covered by given polygon:
294
295 <div class="code"><pre>
296 v.edit tool=catadd map=roads \
297 polygon=599877.75,4925088.375,597164.812,4922524.5,601338.562,4920914.625 \
298 layer=2 cat=1,3-5
299 </pre></div>
300
301 Delete layer/category 1/1, line id 1:
302
303 <div class="code"><pre>
304 v.edit tool=catdel map=roads id=1 cats=5
305 </pre></div>
306
307 <h3>Merge lines</h3>
308
309 Merge two lines with given category number:
310
311 <div class="code"><pre>
312 v.edit map=roads tool=merge cat=4
313 </pre></div>
314
315 <h3>Split line on given point</h3>
316
317 Split line id 810 on coordinates 604268,4923570 in threshold 50 map units:
318
319 <div class="code"><pre>
320 v.edit map=roads tool=break coords=604268,4923570 id=810 threshold=50
321 </pre></div>
322
323 <h3>Break selected lines at each intersection</h3>
324
325 Break selected lines (with category number 1) at each intersection:
326
327 <div class="code"><pre>
328 v.edit map=roads tool=break cat=1
329 </pre></div>
330
331 <h3>Snap lines</h3>
332
333 Snap all lines using threshold distance 20 map units:
334
335 <div class="code"><pre>
336 v.edit map=roads id=1-9999 tool=snap threshold=-1,20 type=line
337 </pre></div>
338
339 <h3>Connect lines</h3>
340
341 Connect line id 48 to line id 565:
342
343 <div class="code"><pre>
344 v.edit map=roads tool=connect id=48,565
345 </pre></div>
346
347 Connect line id 48 to line id 565; line id 60 to line id
348 50. Maximum threshold distance is 700 map units:
349
350 <div class="code"><pre>
351 v.edit map=roads tool=connect id=48,565,60,50 threshold=-1,700
352 </pre></div>
353
354 <h3>Add vertex</h3>
355
356 Add new vertex to the line located at 600952,4926107, threshold is
357 set to 1 map unit:
358
359 <div class="code"><pre>
360 v.edit tool=vertexadd map=roads coords=600952,4926107 threshold=1
361 </pre></div>
362
363 <h3>Delete vertices</h3>
364
365 Delete vertex located at 593191.608,4925684.849 (threshold set to 0.1 map units).
366 Modify only lines with category 1:
367
368 <div class="code"><pre>
369 v.edit tool=vertexdel map=roads coord=593191.608,4925684.849 \
370 threshold=1-e1 cats=1
371 </pre></div>
372
373 <h3>Move vertices</h3>
374
375 Move vertices located at 604441,4921088 (threshold set to 100 map units).
376 Modify only lines with categories 1-10:
377
378 <div class="code"><pre>
379 v.edit tool=vertexmove map=roads cats=1-10 coord=604441,4921088 \
380 threshold=100 move=1000,1000
381 </pre></div>
382
383 <h3>Select features and print their id's</h3>
384
385 Print id's of selected features, e.g.:
386
387 <div class="code"><pre>
388 v.edit map=soils@PERMANENT tool=select \
389 bbox=595733.8125,4919781.75,598536.1875,4917396.75 --q
390 </pre></div>
391
392 Example with <em><a href="d.vect.html">d.vect</a></em>:
393
394 <div class="code"><pre>
395 d.erase;
396 d.vect roads;
397 d.vect -i map=roads cats=`v.edit map=roads tool=select \
398 coord=592542.89243878,4924766.99622811,603389.0625,4918292.1875 \
399 threshold=1000 --q` col=red
400 </pre></div>
401
402 Select all lines shorter (or equal) than 10 map units:
403
404 <div class="code"><pre>
405 v.edit map=roads tool=select query=length threshold=-1,0,-10
406 </pre></div>
407
408 Select from given bounding box all lines longer then 200 map units:
409
410 <div class="code"><pre>
411 v.edit map=roads tool=select bbox=598260,4919730,605100,4926240 query=length threshold=-1,0,200
412 </pre></div>
413
414 <h3>Fix height of contours</h3>
415
416 Input vector map contains 2D lines representing contours. Height can
417 be assign to the contours using <b>tool=zbulk</b>. First of all 2D
418 lines need to be converted to 3D lines:
419
420 <div class="code"><pre>
421 v.extrude input=line2 output=line3 height=0 type=line
422 </pre></div>
423
424 All lines which intersect with the line given by coordinates will be
425 modified. First found line will get height 1000 map units, height of
426 other selected lines will be increased by 10 map units.
427
428 <div class="code"><pre>
429 v.edit a2 tool=zbulk bbox=586121.25049368,4911970.21547109,603092.60466035,4927071.25713776 \
430 zbulk=1000,10
431 </pre></div>
432
433 <h2>SEE ALSO</h2>
434
435 <em>
436 <a href="v.in.ascii.html">v.in.ascii</a>,
437 <a href="v.info.html">v.info</a>,
438 <a href="v.build.html">v.build</a>,
439 <a href="v.build.polylines.html">v.build.polylines</a>,
440 <a href="v.clean.html">v.clean</a>,
441 <a href="v.extrude.html">v.extrude</a>,
442 <a href="v.split.html">v.split</a>
443 </em>
444
445 <p>See also <em><a href="wxGUI.vdigit.html">wxGUI vector digitizer</a></em>.
446
447 <h2>AUTHORS</h2>
448
449 Original author: Wolf Bergenheim - independent developer<br>
450 Initial updates: Jachym Cepicky, Mendel University of Agriculture and Forestry in Brno, Czech Republic<br>
451 Major update by Martin Landa, FBK-irst (formerly ITC-irst), Trento, Italy<br>
452 Extend tools by Huidae Cho