v.lrs.create(1)
π v.lrs.create β the GRASS GIS manual, but make it make sense π
okay bestie, pull up a chair because we're diving into v.lrs.create(1) from the GRASS GIS User's Manual and honestly? it's giving main character energy for linear reference systems. no cap. π¦
β¨ NAME β¨
v.lrs.create β creates a linear reference system. that's it. that's the whole job. slay. π
π KEYWORDS π
vector, linear reference system, network. iykyk. π
β SYNOPSIS β
here's the vibe check on how you actually call it, verbatim:
v.lrs.create
v.lrs.create --help
v.lrs.create in_lines=name out_lines=name [err=name] points=name
[llayer=string] [player=string] lidcol=string pidcol=string
[start_mp=string] [start_off=string] [end_mp=string]
[end_off=string] [rsdriver=string] [rsdatabase=string]
rstable=string [threshold=float] [--overwrite] [--help] [--verbose]
[--quiet] [--ui]
π Flags π
the little switches, the accessories of the command line. each one is iconic in its own way:
--overwriteβ allow output files to overwrite existing files. yes she will absolutely replace things, so be aware bestie π--helpβ print usage summary. your girl when you're lost.--verboseβ verbose module output. it will tell you everything, and honestly? we love a chatty icon π¬--quietβ quiet module output. the introvert setting.--uiβ force launching GUI dialog. for when you want buttons instead of typing. no judgment π«Ά
πΈ Parameters πΈ
okay now the real ones. the parameters. read carefully, bestie, because the required ones are required fr fr:
in_lines=name[required] β name of input vector map. this is the input vector map containing lines. πout_lines=name[required] β output vector map where oriented lines are written. the glow-up version of your lines β¨err=nameβ output vector map of errors. yes, there's a whole map for the oopsies. she's honest like that πpoints=name[required] β name of input vector map. it's the input vector map containing reference points πllayer=stringβ layer number or name. it's the line layer. Default:1player=stringβ layer number or name. it's the point layer. Default:1lidcol=string[required] β column containing line identifiers for lines π―pidcol=string[required] β column containing line identifiers for points π―start_mp=stringβ column containing milepost position for the beginning of next segment. Default:start_mpstart_off=stringβ column containing offset from milepost for the beginning of next segment. Default:start_offend_mp=stringβ column containing milepost position for the end of previous segment. Default:end_mpend_off=stringβ column containing offset from milepost for the end of previous segment. Default:end_offrsdriver=stringβ driver name for reference system table. Options:dbf,mesql,mysql,odbc,ogr,pg,sqlite. Default:sqlitersdatabase=stringβ database name for reference system table. Default:$GISDBASE/$LOCATION_NAME/$MAPSET/sqlite/sqlite.dbrstable=string[required] β name of table where the reference system will be written. heads up: a new table is created by this module πthreshold=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. so like, lines + points = a whole reference system. chemistry. π§ͺβ¨
and listen β it is highly recommended to work with polylines instead of segmented vector lines. the command v.build.polylines creates this map structure. do it. trust. π
π¦ NOTES π¦
okay important deets, don't skip these:
- the mileposts (point) vector map columns
start_mp,start_off,end_mp,end_offmust be of 'double precision' type. non-negotiable bestie, the type has to match or it's not gonna work π - for milepost ordering, it is sufficient to enter increasing numbers into the
start_mpcolumn indicating the order along the vector line. basically just count up and the order sorts itself out π - the
lidcolandpidcolcolumns contain the line IDs which relate mileposts and vector line(s) to each other. it's the matching key, the situationship glue π - when creating a LRS with this module, any existing
rstablewill be replaced. not merged, not appended β replaced. so if you had something there, it's gone-gone π
π EXAMPLE π
this example is written for the Spearfish dataset. periodt.
πΈ Step one: bus route data prep πΈ
as first step, bus route data are prepared.
# break into segments for correct route selection
v.clean roads_net out=busroute_tmp tool=break
# make polyline for easier line selection by coordinate pairs
v.build.polylines busroute_tmp out=busroute_tmp2
# reverse delete: reduce route map to bus route (enter in one line)
v.edit -r busroute_tmp2 tool=delete coords=590273,4927304,\
590346,4927246,590414,4927210,590438,4927096,590468,4926966,\
590491,4926848,590566,4926798,590637,4926753,590701,4926698,\
590830,4926726,590935,4926751,590993,4926830,590972,4926949,\
590948,4927066,590922,4927182,590957,4927251 threshold=5
# vector line needs to be polyline
v.build.polylines busroute_tmp2 out=busroute_tmp3
v.category busroute_tmp3 out=busroute op=add
g.remove -f type=vector name=busroute_tmp,busroute_tmp2,busroute_tmp3
the result can be visualized:
g.region vector=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
and the output is literally:
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
echo "590263|4927361
590432|4927120
590505|4926776
590660|4926687
590905|4926742
590972|4926949
591019|4927263" | v.in.ascii out=busstops
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
which gives you:
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|||
then visualize with start_mp to check the 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. future-proofing, we love to see it π
π Step two: build the linear reference network π
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 threshold=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 table=route_lrs
d.vect route_lrs col=blue width=2
and that's the whole glow-up. β¨
π₯ SEE ALSO π₯
your recommended reading, bestie:
v.build.polylinesv.lrs.segmentv.lrs.wherev.lrs.label
also: the LRS tutorial, and Introducing the Linear Reference System in GRASS. go read, you'll be obsessed ππ
π 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.create source code (history)
Accessed: Saturday Jan 17 05:41:24 2026
Main index | Vector index | Topics index | Keywords index | Graphical index | Full index
Β© 2003-2025 GRASS Development Team, GRASS GIS 8.4.2 Reference Manual
and that's the whole page, bestie π big love to the GRASS Development Team for the Β© 2003-2025 and for shipping this as part of the GRASS GIS 8.4.2 Reference Manual β this page was accessed Saturday Jan 17 05:41:24 2026, and you read it just now, so consider yourself caught up π«Άβ¨ no cap, go build that LRS. π
π¦ where this page comes from
- fedora 44: grass 8.4.2-4.fc44 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms