Skip to content

v.lrs.segment

Creates points/segments from input lines, linear reference system and positions read from stdin or a file.

v.lrs.segment input=name output=name [llayer=string] [rsdriver=string] [rsdatabase=string] rstable=string [file=name] [--overwrite] [--verbose] [--quiet] [--qq] [--ui]

Example:

v.lrs.segment input=name output=name rstable=string

grass.script.run_command("v.lrs.segment", input, output, llayer="1", rsdriver="sqlite", rsdatabase="$GISDBASE/$LOCATION_NAME/$MAPSET/sqlite/sqlite.db", rstable, file=None, overwrite=False, verbose=False, quiet=False, superquiet=False)

Example:

gs.run_command("v.lrs.segment", input="name", output="name", rstable="string")

Parameters

input=name [required]
    Name of input vector map
    Input vector map containing lines
output=name [required]
    Output vector map where segments will be written
llayer=string
    Layer number or name
    Line layer
    Default: 1
rsdriver=string
    Driver name for reference system table
    Allowed values: dbf, ogr, sqlite
    Default: sqlite
rsdatabase=string
    Database name for reference system table
    Default: $GISDBASE/$LOCATION_NAME/$MAPSET/sqlite/sqlite.db
rstable=string [required]
    Name of the reference system table
file=name
    Name of file containing segment rules. If not given, read from stdin.
--overwrite
    Allow output files to overwrite existing files
--help
    Print usage summary
--verbose
    Verbose module output
--quiet
    Quiet module output
--qq
    Very quiet module output
--ui
    Force launching GUI dialog

input : str, required
    Name of input vector map
    Input vector map containing lines
    Used as: input, vector, name
output : str, required
    Output vector map where segments will be written
    Used as: output, vector, name
llayer : str, optional
    Layer number or name
    Line layer
    Used as: input, layer
    Default: 1
rsdriver : str, optional
    Driver name for reference system table
    Allowed values: dbf, ogr, sqlite
    Default: sqlite
rsdatabase : str, optional
    Database name for reference system table
    Default: $GISDBASE/$LOCATION_NAME/$MAPSET/sqlite/sqlite.db
rstable : str, required
    Name of the reference system table
file : str, optional
    Name of file containing segment rules. If not given, read from stdin.
    Used as: input, file, name
overwrite: bool, optional
    Allow output files to overwrite existing files
    Default: False
verbose: bool, optional
    Verbose module output
    Default: False
quiet: bool, optional
    Quiet module output
    Default: False
superquiet: bool, optional
    Very quiet module output
    Default: False

DESCRIPTION

v.lrs.segment creates points/segments from input lines, linear reference system and positions read from standard in or a file.

The format is as follows:

P <point_id> <line_id> <milepost>+<offset> [<side offset>]
L <segment_id> <line_id> <milepost>+<offset> <milepost>+<offset> [<side offset>]

NOTES

For more information and examples see the help page for v.lrs.segment's sister module, v.segment.

EXAMPLE

This example is written for the Spearfish dataset (it continues the example from v.lrs.create).

In this example, the 'route_lrs' shall be extended for a new position (point) along the LRS after bus stop 4:

# new point on LRS
echo "P 7 22 4+180" | v.lrs.segment route_lrs out=route_lrs_new rstable=route_lrs

g.region vector=route_lrs n=n+100 s=s-100 -p
d.erase
# existing LRS
d.vect route_lrs
d.vect busstops disp=attr attr=cat size=10 bg=white lcol=blue yref=bottom
d.vect busstops icon=basic/circle fcol=blue
db.select table=route_lrs

# show modified map
d.vect route_lrs_new col=red

TODO

Figure out how to merge result into existing LRS map and table.

SEE ALSO

v.lrs.create, v.lrs.where, v.lrs.label, v.segment

LRS tutorial,
Introducing the Linear Reference System in GRASS

AUTHOR

Radim Blazek

SOURCE CODE

Available at: v.lrs.segment source code (history)
Latest change: Friday Feb 07 19:16:09 2025 in commit a82a39f