v.segment.html 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  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>'. It includes the creation
  4. of parallel lines or points in given destination from the line.
  5. <p>The format is:
  6. <div class="code"><pre>
  7. P &lt;point id&gt; &lt;line cat&gt; &lt;offset&gt; [&lt;side offset&gt;]
  8. L &lt;segment id&gt; &lt;line cat&gt; &lt;start offset&gt; &lt;end offset&gt; [&lt;side offset&gt;]
  9. </pre></div>
  10. The offsets can be percent values of the line length. If the offsets are
  11. negative, they start from the end node of the line. -0 means the end of the
  12. line.
  13. <h3>EXAMPLE</h3>
  14. The user could send to <tt>stdin</tt> something like:
  15. <div class="code"><pre>
  16. P 1 356 24.56
  17. P 2 495 12.31
  18. P 3 500 -12.31
  19. P 4 510 -20%
  20. ...
  21. </pre></div>
  22. (pipe or redirect from file into the command).<br>
  23. <h2>NOTES</h2>
  24. A segment is only created for the first line found of the specified category.
  25. <p>Points are generated along the lines at the given distance(s) or percent(s)
  26. of the line length from the beginning or end, if offsets are negative, of the
  27. vector line.
  28. <p>The side offset is the orthogonal distance from the line. Positive side
  29. offsets are to the right side of the line going forward, negative offsets
  30. are to the left (<em>d.vect</em> with <em>display=shape,dir</em> shows
  31. the direction of vector lines). As the segment distance is measured along the
  32. original line, side-offset lines will be longer than the start-end segment distance
  33. for outside corners of curving lines, and shorter for inside corners.
  34. <p>All offsets are measured in map units (see "<em>g.proj -p</em>") or percents
  35. of the line length, if followed by a % character.
  36. <p>To place a point in the middle of a line, 50% offset can be used or the
  37. <em>v.to.db</em> module may be used to find the line's length. Then half of
  38. that distance can be used as the along-line offset.
  39. <h2>EXAMPLES</h2>
  40. The examples may be used in the North Carolina sample location.
  41. <p>
  42. Example: Extract line segment from 400m to 5000m from beginning
  43. of line 1:
  44. <div class="code"><pre>
  45. # extract lines from railroad map:
  46. v.extract railroads out=myrr cats=1
  47. # join segments into polyline and reassign category numbers
  48. v.build.polylines myrr out=myrr_pol
  49. v.category myrr_pol out=myrailroads option=add
  50. # zoom to an area of interest
  51. g.region vector=myrailroads -p
  52. # show line, category, direction (to find the beginning)
  53. d.mon wx0
  54. d.vect myrailroads disp=shape,cat,dir lsize=12
  55. # extract line segment from 400m to 5000m from beginning of line 1
  56. echo "L 1 1 400 5000" | v.segment myrailroads out=myrailroads_segl
  57. d.erase
  58. d.vect myrailroads
  59. d.vect myrailroads_segl col=green width=2
  60. # set node at 5000m from beginning of line 1
  61. echo "P 1 1 5000" | v.segment myrailroads out=myrailroads_segp
  62. d.vect myrailroads_segp icon=basic/circle color=red fcolor=red size=5
  63. </pre></div>
  64. <center>
  65. <img src="v_segment_subline.jpg"><br>
  66. Extract line segment from 400m to 5000m from beginning
  67. of line 1
  68. </center>
  69. <p>
  70. Example: Create parallel 1km long line segments along first 8km of
  71. track, offset 500m to the left of the tracks.
  72. <div class="code"><pre>
  73. v.segment myrailroads out=myrailroads_segl_side &lt;&lt; EOF
  74. L 1 1 1000 2000 -500
  75. L 2 1 3000 4000 -500
  76. L 3 1 5000 6000 -500
  77. L 4 1 7000 8000 -500
  78. EOF
  79. d.erase
  80. d.vect myrailroads disp=shape,dir
  81. d.vect -c myrailroads_segl_side width=2
  82. </pre></div>
  83. <p>
  84. Example: A series of points, spaced every 2km along the tracks
  85. <div class="code"><pre>
  86. v.segment myrailroads out=myrailroads_pt2km &lt;&lt; EOF
  87. P 1 1 1000
  88. P 2 1 3000
  89. P 3 1 5000
  90. P 4 1 7000
  91. EOF
  92. d.erase
  93. d.vect myrailroads disp=shape,dir
  94. d.vect myrailroads_pt2km icon=basic/circle color=blue fcolor=blue size=5
  95. </pre></div>
  96. <center>
  97. <img src="v_segment_spaced_points.jpg"><br>
  98. A series of points, spaced every 2km along the tracks
  99. </center>
  100. <p>
  101. Example: A series of points, spaced every 2km along the tracks, offset 500m to the right
  102. <div class="code"><pre>
  103. v.segment myrailroads out=myrailroads_pt2kmO500m &lt;&lt; EOF
  104. P 1 1 1000 500
  105. P 2 1 3000 500
  106. P 3 1 5000 500
  107. P 4 1 7000 500
  108. EOF
  109. d.erase
  110. d.vect myrailroads disp=shape,dir
  111. d.vect myrailroads_pt2kmO500m icon=basic/circle color=aqua fcolor=aqua size=5
  112. </pre></div>
  113. <center>
  114. <img src="v_segment_spaced_right_points.jpg"><br>
  115. A series of points, spaced every 2km along the tracks, offset 500m to the right
  116. </center>
  117. <p>
  118. Example: A series of points, spaced every 10% of the line's length along the
  119. tracks from the end of the line up to the middle point, offset 500m to the right
  120. <div class="code"><pre>
  121. v.segment myrailroads out=myrailroads_pt10pctO500m &lt;&lt; EOF
  122. P 1 1 -0% 500
  123. P 2 1 -10% 500
  124. P 3 1 -20% 500
  125. P 4 1 -30% 500
  126. P 5 1 -40% 500
  127. P 6 1 -50% 500
  128. EOF
  129. d.erase
  130. d.vect myrailroads disp=shape,dir
  131. d.vect myrailroads_pt10pctO500m icon=basic/circle color=red fcolor=black size=5
  132. </pre></div>
  133. <center>
  134. <img src="v_segment_spaced_percent_points.jpg"><br>
  135. A series of points, spaced every 10% of the line's length along the
  136. tracks from the end of the line up to the middle point, offset 500m to the right
  137. </center>
  138. <h2>KNOWN ISSUES</h2>
  139. There is a problem with side-offset parallel line generation for inside corners.
  140. <!-- in Vect_line_parallel(), v.parallel is also affected -->
  141. <h2>SEE ALSO</h2>
  142. <em>
  143. <a href="lrs.html">LRS tutorial</a> (Linear Referencing System),<br>
  144. <a href="d.vect.html">d.vect</a>,
  145. <a href="v.build.polylines.html">v.build.polylines</a>,
  146. <a href="v.lrs.segment.html">v.lrs.segment</a>,
  147. <a href="v.parallel.html">v.parallel</a>,
  148. <a href="v.split.html">v.split</a>,
  149. <a href="v.to.db.html">v.to.db</a>,
  150. <a href="v.to.points.html">v.to.points</a>
  151. </em>
  152. <h2>AUTHOR</h2>
  153. Radim Blazek, ITC-Irst, Trento, Italy
  154. <p><i>Last changed: $Date$</i>