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