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