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
11
13 v.segment
14 v.segment help
15 v.segment input=name output=name [llayer=integer] [file=name]
16 [--overwrite] [--verbose] [--quiet]
17
18 Flags:
19 --overwrite
20 Allow output files to overwrite existing files
21
22 --verbose
23 Verbose module output
24
25 --quiet
26 Quiet module output
27
28 Parameters:
29 input=name
30 Name of input vector map containing lines
31
32 output=name
33 Name for output vector map where segments will be written
34
35 llayer=integer
36 Line layer
37 A single vector map can be connected to multiple database tables.
38 This number determines which table to use.
39 Default: 1
40
41 file=name
42 Name of file containing segment rules. If not given, read from
43 stdin.
44
46 v.segment generates segments or points from input lines and from posi‐
47 tions read from a text file or 'stdin'.
48
49 The format is:
50 P <point id> <line cat> <offset> [<side offset>]
51 L <segment id> <line cat> <start offset> <end offset> [<;side offset>;]
52
53
54 EXAMPLE
55 The user could send to stdin something like:
56 P 1 356 24.56
57 P 2 495 12.31
58 (pipe or redirect from file into the command).
59
61 A segment is only created for the first line found of the specified
62 category.
63
64 Points are generated along the lines at the given distance(s) from the
65 beginning of the vector line.
66
67 The side offset is the orthogonal distance from the line. Positive side
68 offsets are to the right side of the line going forward, negative off‐
69 sets are to the left (d.vect with display=shape,dir shows the direction
70 of vector lines). As the segment distance is measured along the origi‐
71 nal line, side-offset lines will be longer than the start-end segment
72 distance for outside corners of curving lines, and shorter for inside
73 corners.
74
75 All offsets are measured in map units (see "g.proj -p").
76
77 To place a point in the middle of a line, the v.to.db module may be
78 used to find the line's length. Then half of that distance can be used
79 as the along-line offset.
80
82 Spearfish location:
83 # extract lines from railroad map:
84 v.extract railroads out=myrr list=1
85 # join segments into polyline and reassign category numbers
86 v.build.polylines myrr out=myrr_pol
87 v.category myrr_pol out=myrailroads option=add
88 # zoom to an area of interest
89 g.region n=4928200 s=4921100 w=605600 e=613200
90 # show line, category, direction (to find the beginning)
91 d.vect myrailroads disp=shape,cat,dir lsize=12
92 # extract line segment from 400m to 5000m from beginning of line 1
93 echo "L 1 1 400 5000" | v.segment myrailroads out=myrailroads_segl
94 d.erase
95 d.vect myrailroads
96 d.vect myrailroads_segl col=green width=2
97 # set node at 5000m from beginning of line 1
98 echo "P 1 1 5000" | v.segment myrailroads out=myrailroads_segp
99 d.vect myrailroads_segp icon=basic/circle color=red fcolor=red size=5
100 # get points from a text file
101 cat mypoints.txt | v.segment myrailroads out=myrailroads_mypoints
102 # create parallel 1km long line segments along first 8km of track,
103 # offset 500m to the left of the tracks.
104 v.segment myrailroads out=myrailroads_segl_side << EOF
105 L 1 1 1000 2000 -500
106 L 2 1 3000 4000 -500
107 L 3 1 5000 6000 -500
108 L 4 1 7000 8000 -500
109 EOF
110 d.erase
111 d.vect myrailroads disp=shape,dir
112 d.vect -c myrailroads_segl_side width=2
113 # A series of points, spaced every 2km along the tracks
114 v.segment myrailroads out=myrailroads_pt2km << EOF
115 P 1 1 1000
116 P 2 1 3000
117 P 3 1 5000
118 P 4 1 7000
119 EOF
120 d.vect myrailroads_pt2km icon=basic/circle color=blue fcolor=blue
121 size=5
122 # A series of points, spaced every 2km along the tracks, offset 500m to
123 the right
124 v.segment myrailroads out=myrailroads_pt2kmO500m << EOF
125 P 1 1 1000 500
126 P 2 1 3000 500
127 P 3 1 5000 500
128 P 4 1 7000 500
129 EOF
130 d.vect myrailroads_pt2kmO500m icon=basic/circle color=aqua fcolor=aqua
131 size=5
132
133
135 There is a problem with side-offset parallel line generation for inside
136 corners.
137
139 LRS tutorial (Linear Referencing System),
140 d.vect, v.build.polylines, v.lrs.segment, v.parallel, v.split, v.to.db,
141 v.to.points
142
144 Radim Blazek, ITC-Irst, Trento, Italy
145
146 Last changed: $Date: 2007-12-17 14:45:01 +0100 (Mon, 17 Dec 2007) $
147
148 Full index
149
150 © 2003-2008 GRASS Development Team
151
152
153
154GRASS 6.3.0 v.segment(1)