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