v.segment.html 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. <h2>DESCRIPTION</h2>
  2. <em>v.segment</em> generates segments or points from input lines and from
  3. positions read from a text file or '<tt>stdin</tt>'.
  4. <p>The format is:
  5. <div class="code"><pre>
  6. P &lt;point id&gt; &lt;line cat&gt; &lt;offset&gt; [&lt;side offset&gt;]
  7. L &lt;segment id&gt; &lt;line cat&gt; &lt;start offset&gt; &lt;end offset&gt; [&lt;side offset&gt;]
  8. </pre></div>
  9. <h3>EXAMPLE</h3>
  10. The user could send to <tt>stdin</tt> something like:
  11. <div class="code"><pre>
  12. P 1 356 24.56
  13. P 2 495 12.31
  14. ...
  15. </pre></div>
  16. (pipe or redirect from file into the command).<br>
  17. <h2>NOTES</h2>
  18. A segment is only created for the first line found of the specified category.
  19. <p>Points are generated along the lines at the given distance(s) from the
  20. beginning of the vector line.
  21. <p>The side offset is the orthogonal distance from the line. Positive side
  22. offsets are to the right side of the line going forward, negative offsets
  23. are to the left (<em>d.vect</em> with <em>display=shape,dir</em> shows
  24. the direction of vector lines). As the segment distance is measured along the
  25. original line, side-offset lines will be longer than the start-end segment distance
  26. for outside corners of curving lines, and shorter for inside corners.
  27. <p>All offsets are measured in map units (see "<em>g.proj -p</em>").
  28. <p>To place a point in the middle of a line, the <em>v.to.db</em> module may be
  29. used to find the line's length. Then half of that distance can be used as the
  30. along-line offset.
  31. <h2>EXAMPLES</h2>
  32. Spearfish location:
  33. <div class="code"><pre>
  34. # extract lines from railroad map:
  35. v.extract railroads out=myrr list=1
  36. # join segments into polyline and reassign category numbers
  37. v.build.polylines myrr out=myrr_pol
  38. v.category myrr_pol out=myrailroads option=add
  39. # zoom to an area of interest
  40. g.region n=4928200 s=4921100 w=605600 e=613200
  41. # show line, category, direction (to find the beginning)
  42. d.vect myrailroads disp=shape,cat,dir lsize=12
  43. # extract line segment from 400m to 5000m from beginning of line 1
  44. echo "L 1 1 400 5000" | v.segment myrailroads out=myrailroads_segl
  45. d.erase
  46. d.vect myrailroads
  47. d.vect myrailroads_segl col=green width=2
  48. # set node at 5000m from beginning of line 1
  49. echo "P 1 1 5000" | v.segment myrailroads out=myrailroads_segp
  50. d.vect myrailroads_segp icon=basic/circle color=red fcolor=red size=5
  51. # get points from a text file
  52. cat mypoints.txt | v.segment myrailroads out=myrailroads_mypoints
  53. # create parallel 1km long line segments along first 8km of track,
  54. # offset 500m to the left of the tracks.
  55. v.segment myrailroads out=myrailroads_segl_side << EOF
  56. L 1 1 1000 2000 -500
  57. L 2 1 3000 4000 -500
  58. L 3 1 5000 6000 -500
  59. L 4 1 7000 8000 -500
  60. EOF
  61. d.erase
  62. d.vect myrailroads disp=shape,dir
  63. d.vect -c myrailroads_segl_side width=2
  64. # A series of points, spaced every 2km along the tracks
  65. v.segment myrailroads out=myrailroads_pt2km << EOF
  66. P 1 1 1000
  67. P 2 1 3000
  68. P 3 1 5000
  69. P 4 1 7000
  70. EOF
  71. d.vect myrailroads_pt2km icon=basic/circle color=blue fcolor=blue size=5
  72. # A series of points, spaced every 2km along the tracks, offset 500m to the right
  73. v.segment myrailroads out=myrailroads_pt2kmO500m << EOF
  74. P 1 1 1000 500
  75. P 2 1 3000 500
  76. P 3 1 5000 500
  77. P 4 1 7000 500
  78. EOF
  79. d.vect myrailroads_pt2kmO500m icon=basic/circle color=aqua fcolor=aqua size=5
  80. </pre></div>
  81. <h2>BUGS</h2>
  82. There is a problem with side-offset parallel line generation for inside corners.
  83. <!-- in Vect_line_parallel(), v.parallel is also affected -->
  84. <h2>SEE ALSO</h2>
  85. <em>
  86. <a href="lrs.html">LRS tutorial</a> (Linear Referencing System),<br>
  87. <a href="d.vect.html">d.vect</a>,
  88. <a href="v.build.polylines.html">v.build.polylines</a>,
  89. <a href="v.lrs.segment.html">v.lrs.segment</a>,
  90. <a href="v.parallel.html">v.parallel</a>,
  91. <a href="v.split.html">v.split</a>,
  92. <a href="v.to.db.html">v.to.db</a>,
  93. <a href="v.to.points.html">v.to.points</a>
  94. </em>
  95. <h2>AUTHOR</h2>
  96. Radim Blazek, ITC-Irst, Trento, Italy
  97. <p><i>Last changed: $Date$</i>