1v.lrs.create(1) Grass User's Manual v.lrs.create(1)
2
3
4
6 v.lrs.create - Create Linear Reference System
7
9 vector, LRS, networking
10
12 v.lrs.create
13 v.lrs.create help
14 v.lrs.create in_lines=name out_lines=name [err=name] points=name
15 [llayer=integer] [player=integer] lidcol=string pidcol=string
16 [start_mp=string] [start_off=string] [end_mp=string]
17 [end_off=string] rstable=string [thresh=float] [--overwrite]
18 [--verbose] [--quiet]
19
20 Flags:
21 --overwrite
22 Allow output files to overwrite existing files
23
24 --verbose
25 Verbose module output
26
27 --quiet
28 Quiet module output
29
30 Parameters:
31 in_lines=name
32 Input vector map containing lines
33
34 out_lines=name
35 Output vector map where oriented lines are written
36
37 err=name
38 Output vector map of errors
39
40 points=name
41 Input vector map containing reference points
42
43 llayer=integer
44 Layer number
45 Line layer
46 Default: 1
47
48 player=integer
49 Layer number
50 Point layer
51 Default: 1
52
53 lidcol=string
54 Column containing line identifiers for lines
55
56 pidcol=string
57 Column containing line identifiers for points
58
59 start_mp=string
60 Column containing milepost position for the beginning of next seg‐
61 ment
62 Default: start_mp
63
64 start_off=string
65 Column containing offset from milepost for the beginning of next
66 segment
67 Default: start_off
68
69 end_mp=string
70 Column containing milepost position for the end of previous segment
71 Default: end_mp
72
73 end_off=string
74 Column containing offset from milepost for the end of previous seg‐
75 ment
76 Default: end_off
77
78 rstable=string
79 Name of table where the reference system will be written
80 New table is created by this module
81
82 thresh=float
83 Maximum distance of point to line allowed
84 Default: 1
85
87 v.lrs.create generates a LRS (Linear Reference System) from vector line
88 and point data.
89
90 It is highly recommended to work with polylines instead of segmented
91 vector lines. The command v.build.polylines creates this map structure.
92
94 The mileposts (point) vector map columns start_mp, start_off, end_mp,
95 end_off must be of 'double precision' type. For milepost ordering, it
96 is sufficient to enter increasing numbers into the start_mp column
97 indicating the order along the vector line.
98
99 The lidcol and pidcol columns contain the line IDs which relate mile‐
100 posts and vector line(s) to each other.
101
102 When creating a LRS with this module, any existing rstable will be
103 replaced.
104
106 This example is written for the Spearfish dataset.
107
108 As first step, bus route data are prepared.
109 # break into segments for correct route selection
110 v.clean roads_net out=busroute_tmp tool=break
111 # make polyline for easier line selection by coordinate pairs
112 v.build.polylines busroute_tmp out=busroute_tmp2
113 # reverse delete: reduce route map to bus route (enter in one line)
114 v.edit -r busroute_tmp2 tool=delete coords=590273,4927304,\
115 590346,4927246,590414,4927210,590438,4927096,590468,4926966,\
116 590491,4926848,590566,4926798,590637,4926753,590701,4926698,\
117 590830,4926726,590935,4926751,590993,4926830,590972,4926949,\
118 590948,4927066,590922,4927182,590957,4927251 thresh=5
119 # vector line needs to be polyline
120 v.build.polylines busroute_tmp2 out=busroute_tmp3
121 v.category busroute_tmp3 out=busroute op=add
122 g.remove vect=busroute_tmp,busroute_tmp2,busroute_tmp3
123 The result can be visualized:
124 g.region vect=busroute n=n+100 s=s-100 w=w-100 e=e+100
125 d.mon x0
126 d.vect roads_net
127 d.vect busroute col=red width=2
128 The vector map 'busroute' needs have an attribute table which contain
129 an integer column lidcol with value be '22' for this example (bus
130 route):
131 v.db.addtable busroute col="lid integer"
132 v.db.update busroute col=lid value=22
133 v.db.select busroute
134 cat|lid
135 1|22
136 A new point map 'busstops' shall contain mileposts (bus stops) along
137 this line (use thresh to define maximal accepted deviation from this
138 line):
139 # generate points map
140 echo "590263|4927361
141 590432|4927120
142 590505|4926776
143 590660|4926687
144 590905|4926742
145 590972|4926949
146 591019|4927263" | v.in.ascii out=busstops
147 d.vect busstops icon=basic/triangle col=blue
148 d.vect busstops disp=cat lcol=blue
149 The milepost attributes table needs to be created with specific col‐
150 umns:
151 v.db.addtable busstops col="lid integer, start_mp double precision, \
152 start_off double precision, end_mp double precision, \
153 end_off double precision"
154 v.db.update busstops col=lid value=22
155 Since the digitizing order of v.in.ascii above reflects the bus stop
156 order along the route, we can simply copy the category number as mile‐
157 post order number in column start_mp:
158 v.db.update busstops col=start_mp qcol=cat
159 # verify table
160 v.db.select busstops
161 cat|lid|start_mp|start_off|end_mp|end_off
162 1|22|1|||
163 2|22|2|||
164 3|22|3|||
165 4|22|4|||
166 5|22|5|||
167 6|22|6|||
168 7|22|7|||
169 # visualize with start_mp to check order
170 d.erase
171 d.vect roads_net
172 d.vect busroute col=red width=2
173 d.vect busstops icon=basic/triangle col=blue
174 d.vect busstops disp=attr attrcol=start_mp lcol=blue
175 Offsets (start_off, end_off) can be later used in case the route or
176 mileposts get modified.
177
178 As second step, the linear reference network is created:
179 v.lrs.create busroute points=busstops out=route_lrs err=lrs_error \
180 lidcol=lid pidcol=lid rstable=route_lrs thresh=50
181 This creates the maps 'route_lrs' containing the LRS and 'lrs_error'
182 containing the errors if any. The resulting LRS table and map can be
183 shown:
184 # show LRS table
185 db.select route_lrs
186 d.vect route_lrs col=blue width=2
187
188
190 LRS tutorial,
191 Introducing the Linear Reference System in GRASS,
192
193 v.build.polylines, v.lrs.segment, v.lrs.where, v.lrs.label
194
196 Radim Blazek, ITC-irst/MPA Solutions
197 Documentation update (based on above journal article and available
198 fragments): Markus Neteler
199
200 Last changed: $Date: 2007-06-28 17:28:50 +0200 (Thu, 28 Jun 2007) $
201
202 Full index
203
204 © 2003-2008 GRASS Development Team
205
206
207
208GRASS 6.3.0 v.lrs.create(1)