1v.segment(1)                GRASS GIS User's Manual               v.segment(1)
2
3
4

NAME

6       v.segment   - Creates points/segments from input vector lines and posi‐
7       tions.
8

KEYWORDS

10       vector, geometry, node, point, segment, vertex
11

SYNOPSIS

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 ac‐
43           cess 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

DESCRIPTION

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       The user could send to stdin something like:
66       P 1 356 24.56
67       P 2 495 12.31
68       P 3 500 -12.31
69       P 4 510 -20%
70       ...
71       (pipe or redirect from file into the command).
72

NOTES

74       A  segment  is  only  created for the first line found of the specified
75       category.
76
77       Points are generated along the lines at the given distance(s)  or  per‐
78       cent(s)  of  the  line length from the beginning or end, if offsets are
79       negative, of the vector line.
80
81       The side offset is the orthogonal distance from the line. Positive side
82       offsets  are to the right side of the line going forward, negative off‐
83       sets are to the left (d.vect with display=shape,dir shows the direction
84       of  vector lines). As the segment distance is measured along the origi‐
85       nal line, side-offset lines will be longer than the  start-end  segment
86       distance  for  outside corners of curving lines, and shorter for inside
87       corners.
88
89       All offsets are measured in map units (see "g.proj -p") or percents  of
90       the line length, if followed by a % character.
91
92       To place a point in the middle of a line, 50% offset can be used or the
93       v.to.db module may be used to find the line’s length. Then half of that
94       distance can be used as the along-line offset.
95

EXAMPLES

97       The examples are based on the North Carolina sample location.
98
99   Extraction of a line segment
100       Extract line segment from 400m to 5000m from beginning of line 1:
101       # extract lines from railroad map:
102       v.extract input=railroads output=myrr cats=1
103       # join segments into polyline and reassign category numbers
104       v.build.polylines myrr out=myrr_pol
105       v.category input=myrr_pol output=myrailroads option=add
106       # zoom to an area of interest
107       g.region vector=myrailroads -p
108       # show line, category, direction (to find the beginning)
109       d.mon wx0
110       d.vect map=myrailroads display=shape,cat,dir lsize=12
111       # extract line segment from 400m to 5000m from beginning of line 1
112       echo "L 1 1 400 5000" | v.segment input=myrailroads output=myrailroads_segl
113       d.erase
114       d.vect map=myrailroads
115       d.vect map=myrailroads_segl col=green width=2
116       # set node at 5000m from beginning of line 1
117       echo "P 1 1 5000" | v.segment input=myrailroads output=myrailroads_segp
118       d.vect map=myrailroads_segp icon=basic/circle color=red fcolor=red size=5
119       Extract line segment from 400m to 5000m from beginning of line 1
120
121   Parallel line segments
122       Creation  of  parallel,  1km  long line segments along the first 8km of
123       track, offset 500m to the left of the tracks:
124       v.segment input=myrailroads output=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 map=myrailroads display=shape,dir
132       d.vect -c map=myrailroads_segl_side width=2
133
134   Points equidistant along the tracks
135       Creation of a series of points, spaced every 2km along the tracks:
136       v.segment input=myrailroads output=myrailroads_pt2km << EOF
137       P 1 1 1000
138       P 2 1 3000
139       P 3 1 5000
140       P 4 1 7000
141       EOF
142       d.erase
143       d.vect map=myrailroads display=shape,dir
144       d.vect map=myrailroads_pt2km icon=basic/circle color=blue fcolor=blue size=5
145       A series of points, spaced every 2km along the tracks
146
147   Points equidistant along and offset the tracks
148       Creation of a series of points, spaced every 2km along the tracks, off‐
149       set 500m to the right:
150       v.segment input=myrailroads output=myrailroads_pt2kmO500m << EOF
151       P 1 1 1000 500
152       P 2 1 3000 500
153       P 3 1 5000 500
154       P 4 1 7000 500
155       EOF
156       d.erase
157       d.vect map=myrailroads display=shape,dir
158       d.vect map=myrailroads_pt2kmO500m icon=basic/circle color=aqua fcolor=aqua size=5
159       A  series  of points, spaced every 2km along the tracks, offset 500m to
160       the right
161
162   Points equidistant in percent along and offset the tracks
163       Creation of a series of points, spaced every 10% of the  line’s  length
164       along  the tracks from the end of the line up to the middle point, off‐
165       set 500m to the right:
166       v.segment input=myrailroads output=myrailroads_pt10pctO500m << EOF
167       P 1 1  -0% 500
168       P 2 1 -10% 500
169       P 3 1 -20% 500
170       P 4 1 -30% 500
171       P 5 1 -40% 500
172       P 6 1 -50% 500
173       EOF
174       d.erase
175       d.vect map=myrailroads display=shape,dir
176       d.vect map=myrailroads_pt10pctO500m icon=basic/circle color=red fcolor=black size=5
177       A series of points, spaced every 10% of the  line’s  length  along  the
178       tracks  from the end of the line up to the middle point, offset 500m to
179       the right
180

KNOWN ISSUES

182       There is a problem with side-offset parallel line generation for inside
183       corners.
184

SEE ALSO

186        LRS tutorial (Linear Referencing System),
187       d.vect, v.build.polylines, v.lrs.segment, v.parallel, v.split, v.to.db,
188       v.to.points
189

AUTHOR

191       Radim Blazek, ITC-Irst, Trento, Italy
192

SOURCE CODE

194       Available at: v.segment source code (history)
195
196       Accessed: Saturday Jan 21 21:16:19 2023
197
198       Main index | Vector index | Topics index | Keywords index  |  Graphical
199       index | Full index
200
201       © 2003-2023 GRASS Development Team, GRASS GIS 8.2.1 Reference Manual
202
203
204
205GRASS 8.2.1                                                       v.segment(1)
Impressum