1v.segment(1) Grass User's Manual v.segment(1)
2
3
4
6 v.segment - Creates points/segments from input vector lines and posi‐
7 tions.
8
10 vector, geometry, node, point, segment, vertex
11
13 v.segment
14 v.segment --help
15 v.segment input=name [layer=string] output=name [rules=name]
16 [--overwrite] [--help] [--verbose] [--quiet] [--ui]
17
18 Flags:
19 --overwrite
20 Allow output files to overwrite existing files
21
22 --help
23 Print usage summary
24
25 --verbose
26 Verbose module output
27
28 --quiet
29 Quiet module output
30
31 --ui
32 Force launching GUI dialog
33
34 Parameters:
35 input=name [required]
36 Name of input vector lines map
37 Or data source for direct OGR access
38
39 layer=string
40 Layer number or name
41 Vector features can have category values in different layers. This
42 number determines which layer to use. When used with direct OGR
43 access this is the layer name.
44 Default: 1
45
46 output=name [required]
47 Name for output vector map
48
49 rules=name
50 Name of file containing segment rules
51 ’-’ for standard input
52
54 v.segment generates segments or points from input lines and from posi‐
55 tions read from a text file or ’stdin’. It includes the creation of
56 parallel lines or points in given destination from the line.
57
58 The format is:
59 P <point id> <line cat> <offset> [<side offset>]
60 L <segment id> <line cat> <start offset> <end offset> [<side offset>]
61 The offsets can be percent values of the line length. If the offsets
62 are negative, they start from the end node of the line. -0 means the
63 end of the line.
64
65 EXAMPLE
66 The user could send to stdin something like:
67 P 1 356 24.56
68 P 2 495 12.31
69 P 3 500 -12.31
70 P 4 510 -20%
71 ...
72 (pipe or redirect from file into the command).
73
75 A segment is only created for the first line found of the specified
76 category.
77
78 Points are generated along the lines at the given distance(s) or per‐
79 cent(s) of the line length from the beginning or end, if offsets are
80 negative, of the vector line.
81
82 The side offset is the orthogonal distance from the line. Positive side
83 offsets are to the right side of the line going forward, negative off‐
84 sets are to the left (d.vect with display=shape,dir shows the direction
85 of vector lines). As the segment distance is measured along the origi‐
86 nal line, side-offset lines will be longer than the start-end segment
87 distance for outside corners of curving lines, and shorter for inside
88 corners.
89
90 All offsets are measured in map units (see "g.proj -p") or percents of
91 the line length, if followed by a % character.
92
93 To place a point in the middle of a line, 50% offset can be used or the
94 v.to.db module may be used to find the line’s length. Then half of that
95 distance can be used as the along-line offset.
96
98 The examples may be used in the North Carolina sample location.
99
100 Example: Extract line segment from 400m to 5000m from beginning of line
101 1:
102 # extract lines from railroad map:
103 v.extract railroads out=myrr cats=1
104 # join segments into polyline and reassign category numbers
105 v.build.polylines myrr out=myrr_pol
106 v.category myrr_pol out=myrailroads option=add
107 # zoom to an area of interest
108 g.region vector=myrailroads -p
109 # show line, category, direction (to find the beginning)
110 d.mon wx0
111 d.vect myrailroads disp=shape,cat,dir lsize=12
112 # extract line segment from 400m to 5000m from beginning of line 1
113 echo "L 1 1 400 5000" | v.segment myrailroads out=myrailroads_segl
114 d.erase
115 d.vect myrailroads
116 d.vect myrailroads_segl col=green width=2
117 # set node at 5000m from beginning of line 1
118 echo "P 1 1 5000" | v.segment myrailroads out=myrailroads_segp
119 d.vect myrailroads_segp icon=basic/circle color=red fcolor=red size=5
120 Extract line segment from 400m to 5000m from beginning of line 1
121
122 Example: Create parallel 1km long line segments along first 8km of
123 track, offset 500m to the left of the tracks.
124 v.segment myrailroads out=myrailroads_segl_side << EOF
125 L 1 1 1000 2000 -500
126 L 2 1 3000 4000 -500
127 L 3 1 5000 6000 -500
128 L 4 1 7000 8000 -500
129 EOF
130 d.erase
131 d.vect myrailroads disp=shape,dir
132 d.vect -c myrailroads_segl_side width=2
133
134 Example: A series of points, spaced every 2km along the tracks
135 v.segment myrailroads out=myrailroads_pt2km << EOF
136 P 1 1 1000
137 P 2 1 3000
138 P 3 1 5000
139 P 4 1 7000
140 EOF
141 d.erase
142 d.vect myrailroads disp=shape,dir
143 d.vect myrailroads_pt2km icon=basic/circle color=blue fcolor=blue size=5
144 A series of points, spaced every 2km along the tracks
145
146 Example: A series of points, spaced every 2km along the tracks, offset
147 500m to the right
148 v.segment myrailroads out=myrailroads_pt2kmO500m << EOF
149 P 1 1 1000 500
150 P 2 1 3000 500
151 P 3 1 5000 500
152 P 4 1 7000 500
153 EOF
154 d.erase
155 d.vect myrailroads disp=shape,dir
156 d.vect myrailroads_pt2kmO500m icon=basic/circle color=aqua fcolor=aqua size=5
157 A series of points, spaced every 2km along the tracks, offset 500m to
158 the right
159
160 Example: A series of points, spaced every 10% of the line’s length
161 along the tracks from the end of the line up to the middle point, off‐
162 set 500m to the right
163 v.segment myrailroads out=myrailroads_pt10pctO500m << EOF
164 P 1 1 -0% 500
165 P 2 1 -10% 500
166 P 3 1 -20% 500
167 P 4 1 -30% 500
168 P 5 1 -40% 500
169 P 6 1 -50% 500
170 EOF
171 d.erase
172 d.vect myrailroads disp=shape,dir
173 d.vect myrailroads_pt10pctO500m icon=basic/circle color=red fcolor=black size=5
174 A series of points, spaced every 10% of the line’s length along the
175 tracks from the end of the line up to the middle point, offset 500m to
176 the right
177
179 There is a problem with side-offset parallel line generation for inside
180 corners.
181
183 LRS tutorial (Linear Referencing System),
184 d.vect, v.build.polylines, v.lrs.segment, v.parallel, v.split, v.to.db,
185 v.to.points
186
188 Radim Blazek, ITC-Irst, Trento, Italy
189
190 Last changed: $Date: 2015-05-11 02:11:34 +0200 (Mon, 11 May 2015) $
191
193 Available at: v.segment source code (history)
194
195 Main index | Vector index | Topics index | Keywords index | Graphical
196 index | Full index
197
198 © 2003-2019 GRASS Development Team, GRASS GIS 7.4.4 Reference Manual
199
200
201
202GRASS 7.4.4 v.segment(1)