<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>GRASS GIS: v.lrs.create</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link rel="stylesheet" href="grassdocs.css" type="text/css"> </head> <body bgcolor="white"> <img src="grass_logo.png" alt="GRASS logo"><hr align=center size=6 noshade> <h2>NAME</h2> <em><b>v.lrs.create</b></em> - Create Linear Reference System <h2>KEYWORDS</h2> vector, LRS, networking <h2>SYNOPSIS</h2> <b>v.lrs.create</b><br> <b>v.lrs.create help</b><br> <b>v.lrs.create</b> <b>in_lines</b>=<em>name</em> <b>out_lines</b>=<em>name</em> [<b>err</b>=<em>name</em>] <b>points</b>=<em>name</em> [<b>llayer</b>=<em>integer</em>] [<b>player</b>=<em>integer</em>] <b>lidcol</b>=<em>string</em> <b>pidcol</b>=<em>string</em> [<b>start_mp</b>=<em>string</em>] [<b>start_off</b>=<em>string</em>] [<b>end_mp</b>=<em>string</em>] [<b>end_off</b>=<em>string</em>] <b>rstable</b>=<em>string</em> [<b>thresh</b>=<em>float</em>] [--<b>overwrite</b>] [--<b>verbose</b>] [--<b>quiet</b>] <h3>Flags:</h3> <DL> <DT><b>--overwrite</b></DT> <DD>Allow output files to overwrite existing files</DD> <DT><b>--verbose</b></DT> <DD>Verbose module output</DD> <DT><b>--quiet</b></DT> <DD>Quiet module output</DD> </DL> <h3>Parameters:</h3> <DL> <DT><b>in_lines</b>=<em>name</em></DT> <DD>Input vector map containing lines</DD> <DT><b>out_lines</b>=<em>name</em></DT> <DD>Output vector map where oriented lines are written</DD> <DT><b>err</b>=<em>name</em></DT> <DD>Output vector map of errors</DD> <DT><b>points</b>=<em>name</em></DT> <DD>Input vector map containing reference points</DD> <DT><b>llayer</b>=<em>integer</em></DT> <DD>Layer number</DD> <DD>Line layer</DD> <DD>Default: <em>1</em></DD> <DT><b>player</b>=<em>integer</em></DT> <DD>Layer number</DD> <DD>Point layer</DD> <DD>Default: <em>1</em></DD> <DT><b>lidcol</b>=<em>string</em></DT> <DD>Column containing line identifiers for lines</DD> <DT><b>pidcol</b>=<em>string</em></DT> <DD>Column containing line identifiers for points</DD> <DT><b>start_mp</b>=<em>string</em></DT> <DD>Column containing milepost position for the beginning of next segment</DD> <DD>Default: <em>start_mp</em></DD> <DT><b>start_off</b>=<em>string</em></DT> <DD>Column containing offset from milepost for the beginning of next segment</DD> <DD>Default: <em>start_off</em></DD> <DT><b>end_mp</b>=<em>string</em></DT> <DD>Column containing milepost position for the end of previous segment</DD> <DD>Default: <em>end_mp</em></DD> <DT><b>end_off</b>=<em>string</em></DT> <DD>Column containing offset from milepost for the end of previous segment</DD> <DD>Default: <em>end_off</em></DD> <DT><b>rstable</b>=<em>string</em></DT> <DD>Name of table where the reference system will be written</DD> <DD>New table is created by this module</DD> <DT><b>thresh</b>=<em>float</em></DT> <DD>Maximum distance of point to line allowed</DD> <DD>Default: <em>1</em></DD> </DL> <h2>DESCRIPTION</h2> <em>v.lrs.create</em> generates a LRS (Linear Reference System) from vector line and point data. <p> It is highly recommended to work with polylines instead of segmented vector lines. The command <em>v.build.polylines</em> creates this map structure. <h2>NOTES</h2> The mileposts (point) vector map columns <em>start_mp</em>, <em>start_off</em>, <em>end_mp</em>, <em>end_off</em> must be of 'double precision' type. For milepost ordering, it is sufficient to enter increasing numbers into the <em>start_mp</em> column indicating the order along the vector line. <p> The <em>lidcol</em> and <em>pidcol</em> columns contain the line IDs which relate mileposts and vector line(s) to each other. <p> When creating a LRS with this module, any existing <em>rstable</em> will be replaced. <h2>EXAMPLE</h2> This example is written for the Spearfish dataset. <p> As first step, bus route data are prepared. <div class="code"><pre> # 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 thresh=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 vect=busroute_tmp,busroute_tmp2,busroute_tmp3 </pre></div> The result can be visualized: <div class="code"><pre> 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 </pre></div> The vector map 'busroute' needs have an attribute table which contain an integer column <em>lidcol</em> with value be '22' for this example (bus route): <div class="code"><pre> v.db.addtable busroute col="lid integer" v.db.update busroute col=lid value=22 v.db.select busroute cat|lid 1|22 </pre></div> A new point map 'busstops' shall contain mileposts (bus stops) along this line (use <em>thresh</em> to define maximal accepted deviation from this line): <div class="code"><pre> # 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 </pre></div> The milepost attributes table needs to be created with specific columns: <div class="code"><pre> 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 </pre></div> 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 <em>start_mp</em>: <div class="code"><pre> 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 </pre></div> Offsets (<em>start_off</em>, <em>end_off</em>) can be later used in case the route or mileposts get modified. <p> As second step, the linear reference network is created: <div class="code"><pre> v.lrs.create busroute points=busstops out=route_lrs err=lrs_error \ lidcol=lid pidcol=lid rstable=route_lrs thresh=50 </pre></div> 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: <div class="code"><pre> # show LRS table db.select route_lrs d.vect route_lrs col=blue width=2 </pre></div> <h2>SEE ALSO</h2> <em><a HREF="lrs.html">LRS tutorial</a></em>,<br> <em><a HREF="http://gisws.media.osaka-cu.ac.jp/grass04/viewpaper.php?id=50">Introducing the Linear Reference System in GRASS</a></em>, <p> <em><a HREF="v.build.polylines.html">v.build.polylines</a></em>, <em><a HREF="v.lrs.segment.html">v.lrs.segment</a></em>, <em><a HREF="v.lrs.where.html">v.lrs.where</a></em>, <em><a HREF="v.lrs.label.html">v.lrs.label</a></em> <h2>AUTHOR</h2> Radim Blazek, ITC-irst/MPA Solutions<br> Documentation update (based on above journal article and available fragments): Markus Neteler <p><i>Last changed: $Date: 2007-06-28 17:28:50 +0200 (Thu, 28 Jun 2007) $</i> <HR> <P><a href="index.html">Main index</a> - <a href="vector.html">vector index</a> - <a href="full_index.html">Full index</a></P> <P>© 2003-2008 <a href="http://grass.osgeo.org">GRASS Development Team</a></p> </body> </html>