v.lrs.create(1)

NAME
v.lrs.create - Create Linear Reference System

KEYWORDS
vector, LRS, networking

SYNOPSIS
v.lrs.create
v.lrs.create help
v.lrs.create in_lines=name out_lines=name [err=name] points=name [llayer=integer] [player=integer] lidcol=string pidcol=string [start_mp=string] [start_off=string] [end_mp=string] [end_off=string] rstable=string [thresh=float] [--overwrite]

  Flags:

--overwrite

  Parameters:

in_lines=name
    Input vector map containing lines

out_lines=name
    Output vector map where oriented lines are written

err=name
    Output vector map of errors

points=name
    Input vector map containing reference points

llayer=integer
    Line layer Default: 1

player=integer
    Point layer Default: 1

lidcol=string
    Column containing line identifiers for lines

pidcol=string
    Column containing line identifiers for points

start_mp=string
    Column containing milepost position for the beginning of next segment Default: start_mp

start_off=string
    Column containing offset from milepost for the beginning of next segment Default: start_off

end_mp=string
    Column containing milepost position for the end of previous segment Default: end_mp

end_off=string
    Column containing offset from milepost for the end of previous segment Default: end_off

rstable=string
    Name of table where the reference system will be written New table is created by this module

thresh=float
    Maximum distance of point to line allowed Default: 1

DESCRIPTION
v.lrs.create generates a LRS (Linear Reference System) from vector line and point data.

It is highly recommended to work with polylines instead of segmented vector lines. The command v.build.polylines creates this map structure.

NOTES
The mileposts (point) vector map columns start_mp, start_off, end_mp, end_off must be of 'double precision' type. For milepost ordering, it is sufficient to enter increasing numbers into the start_mp column indicating the order along the vector line.

The lidcol and pidcol columns contain the line IDs which relate mileposts and vector line(s) to each other.

When creating a LRS with this module, any existing rstable will be replaced.

EXAMPLE
This example is written for the Spearfish dataset.

As first step, bus route data are prepared.
# copy into own mapset
g.copy roads_net,busroute_tmp
d.mon x0
d.vect busroute_tmp
# zoom to Spearfish (nord-west city)
d.zoom
# reduce route map to bus route (reduce to one line)
d.extract busroute_tmp out=busroute_tmp2
# vector line needs to be polyline
v.build.polylines busroute_tmp2 out=busroute_tmp3
v.category busroute_tmp3 out=busroute op=add
g.remove vect=busroute_tmp,busroute_tmp2,busroute_tmp3
The result can be visualized:
g.region vect=busroute n=n+100 s=s-100 w=w-100 e=e+100
d.mon x0
d.vect roads_net
d.vect busroute col=red width=2
The vector map 'busroute' needs have an attribute table which contain an integer column lidcol with value be '22' for this example (bus route):
v.db.addtable busroute col="lid integer"
v.db.update busroute col=lid value=22
v.db.select busroute
cat|lid
1|22
A new point map 'busstops' shall contain mileposts (bus stops) along this line (use thresh to define maximal accepted deviation from this line):
# generate points map
# use d.where to find coordinates along the bus route
# use v.in.ascii out=busstops to generate map
d.vect busstops icon=basic/triangle col=blue
d.vect busstops disp=cat lcol=blue
The milepost attributes table needs to be created with specific columns:
v.db.addtable busstops col="lid integer, start_mp double precision, \
            start_off double precision, end_mp double precision, \
            end_off double precision"
v.db.update busstops col=lid value=22
Since the digitizing order of v.in.ascii above reflects the bus stop order along the route, we can simply copy the category number as milepost order number in column start_mp:
v.db.update busstops col=start_mp qcol=cat
# verify table
v.db.select busstops
cat|lid|start_mp|start_off|end_mp|end_off
1|22|1|||
2|22|2|||
3|22|3|||
4|22|4|||
5|22|5|||
6|22|6|||
7|22|7|||
# visualize with start_mp to check order
d.erase
d.vect roads_net
d.vect busroute col=red width=2
d.vect busstops icon=basic/triangle col=blue
d.vect busstops disp=attr attrcol=start_mp lcol=blue
Offsets (start_off, end_off) can be later used in case the route or mileposts get modified.

As second step, the linear reference network is created:
v.lrs.create busroute points=busstops out=route_lrs err=lrs_error \
             lidcol=lid pidcol=lid rstable=route_lrs thresh=50
This creates the maps 'route_lrs' containing the LRS and 'lrs_error' containing the errors if any. The resulting LRS table and map can be shown:
# show LRS table
db.select route_lrs
d.vect route_lrs col=blue width=2

SEE ALSO
LRS tutorial,
Introducing the Linear Reference System in GRASS,

v.build.polylines, v.lrs.segment, v.lrs.where, v.lrs.label

AUTHOR
Radim Blazek, ITC-irst/MPA Solutions
Documentation update (based on above journal article and available fragments): Markus Neteler

Last changed: $Date: 2007/06/28 15:42:47 $

Full index