v.segment.html 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  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. <p>
  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 are based on the North Carolina sample location.
  41. <h3>Extraction of a line segment</h3>
  42. 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 input=railroads output=myrr cats=1
  47. # join segments into polyline and reassign category numbers
  48. v.build.polylines myrr out=myrr_pol
  49. v.category input=myrr_pol output=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 map=myrailroads display=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 input=myrailroads output=myrailroads_segl
  57. d.erase
  58. d.vect map=myrailroads
  59. d.vect map=myrailroads_segl col=green width=2
  60. # set node at 5000m from beginning of line 1
  61. echo "P 1 1 5000" | v.segment input=myrailroads output=myrailroads_segp
  62. d.vect map=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. <h3>Parallel line segments</h3>
  70. Creation of parallel, 1km long line segments along the first 8km of
  71. track, offset 500m to the left of the tracks:
  72. <div class="code"><pre>
  73. v.segment input=myrailroads output=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 map=myrailroads display=shape,dir
  81. d.vect -c map=myrailroads_segl_side width=2
  82. </pre></div>
  83. <h3>Points equidistant along the tracks</h3>
  84. Creation of a series of points, spaced every 2km along the tracks:
  85. <div class="code"><pre>
  86. v.segment input=myrailroads output=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 map=myrailroads display=shape,dir
  94. d.vect map=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. <h3>Points equidistant along and offset the tracks</h3>
  101. Creation of a series of points, spaced every 2km along the tracks,
  102. offset 500m to the right:
  103. <div class="code"><pre>
  104. v.segment input=myrailroads output=myrailroads_pt2kmO500m &lt;&lt; EOF
  105. P 1 1 1000 500
  106. P 2 1 3000 500
  107. P 3 1 5000 500
  108. P 4 1 7000 500
  109. EOF
  110. d.erase
  111. d.vect map=myrailroads display=shape,dir
  112. d.vect map=myrailroads_pt2kmO500m icon=basic/circle color=aqua fcolor=aqua size=5
  113. </pre></div>
  114. <center>
  115. <img src="v_segment_spaced_right_points.jpg"><br>
  116. A series of points, spaced every 2km along the tracks, offset 500m to the right
  117. </center>
  118. <h3>Points equidistant in percent along and offset the tracks</h3>
  119. Creation of a series of points, spaced every 10% of the line's length along the
  120. tracks from the end of the line up to the middle point, offset 500m to the right:
  121. <div class="code"><pre>
  122. v.segment input=myrailroads output=myrailroads_pt10pctO500m &lt;&lt; EOF
  123. P 1 1 -0% 500
  124. P 2 1 -10% 500
  125. P 3 1 -20% 500
  126. P 4 1 -30% 500
  127. P 5 1 -40% 500
  128. P 6 1 -50% 500
  129. EOF
  130. d.erase
  131. d.vect map=myrailroads display=shape,dir
  132. d.vect map=myrailroads_pt10pctO500m icon=basic/circle color=red fcolor=black size=5
  133. </pre></div>
  134. <center>
  135. <img src="v_segment_spaced_percent_points.jpg"><br>
  136. A series of points, spaced every 10% of the line's length along the
  137. tracks from the end of the line up to the middle point, offset 500m to the right
  138. </center>
  139. <h2>KNOWN ISSUES</h2>
  140. There is a problem with side-offset parallel line generation for inside corners.
  141. <!-- in Vect_line_parallel(), v.parallel is also affected -->
  142. <h2>SEE ALSO</h2>
  143. <em>
  144. <a href="lrs.html">LRS tutorial</a> (Linear Referencing System),<br>
  145. <a href="d.vect.html">d.vect</a>,
  146. <a href="v.build.polylines.html">v.build.polylines</a>,
  147. <a href="v.lrs.segment.html">v.lrs.segment</a>,
  148. <a href="v.parallel.html">v.parallel</a>,
  149. <a href="v.split.html">v.split</a>,
  150. <a href="v.to.db.html">v.to.db</a>,
  151. <a href="v.to.points.html">v.to.points</a>
  152. </em>
  153. <h2>AUTHOR</h2>
  154. Radim Blazek, ITC-Irst, Trento, Italy