Skip to content

v.lrs.where

Finds line id and real km+offset for given points in vector map using linear reference system.

v.lrs.where lines=name points=name [llayer=string] [player=string] [rsdriver=string] [rsdatabase=string] rstable=string [threshold=float] [--verbose] [--quiet] [--qq] [--ui]

Example:

v.lrs.where lines=name points=name rstable=string

grass.script.run_command("v.lrs.where", lines, points, llayer="1", player="1", rsdriver="sqlite", rsdatabase="$GISDBASE/$LOCATION_NAME/$MAPSET/sqlite/sqlite.db", rstable, threshold=1000, verbose=False, quiet=False, superquiet=False)

Example:

gs.run_command("v.lrs.where", lines="name", points="name", rstable="string")

Parameters

lines=name [required]
    Name of input vector map
    Input vector map containing lines
points=name [required]
    Name of input vector map
    Input vector map containing points
llayer=string
    Layer number or name
    Line layer
    Default: 1
player=string
    Layer number or name
    Point 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
threshold=float
    Maximum distance to nearest line
    Default: 1000
--help
    Print usage summary
--verbose
    Verbose module output
--quiet
    Quiet module output
--qq
    Very quiet module output
--ui
    Force launching GUI dialog

lines : str, required
    Name of input vector map
    Input vector map containing lines
    Used as: input, vector, name
points : str, required
    Name of input vector map
    Input vector map containing points
    Used as: input, vector, name
llayer : str, optional
    Layer number or name
    Line layer
    Used as: input, layer
    Default: 1
player : str, optional
    Layer number or name
    Point 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
threshold : float, optional
    Maximum distance to nearest line
    Default: 1000
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.where identifies line id and real milepost+offset for points in vector map using linear reference system.

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 queried for unknown positions (points, stored in the map newpoints) along the LRS:

# generate query points
echo "590866.15|4926737.0
590933|4927133" | v.in.ascii out=newpoints

v.lrs.where lines=route_lrs points=newpoints rstable=route_lrs
pcat|lid|mpost|offset
pcat|lid|mpost|offset
1|22|4.000000+212.091461
2|22|6.000000+188.112093

# verification
g.region vector=route_lrs n=n+100 s=s-100 -p
d.erase
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
d.vect newpoints col=red

# measure distance to previous bus stop:
# use measuring tool in graphical user interface

SEE ALSO

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

LRS tutorial,
Introducing the Linear Reference System in GRASS

AUTHORS

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

SOURCE CODE

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