v.split.html 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. <h2>DESCRIPTION</h2>
  2. <em>v.split</em> splits vector lines into shorter segments using
  3. a maximal distance between nodes. The resulting length of all segments
  4. is expected to be equal and not higher than the given <b>length</b>
  5. parameter.
  6. <h2>NOTES</h2>
  7. <em>v.split</em> does not change the layer, nor the category information,
  8. nor the attribute table links of the original file. It just splits each
  9. line in segments and attributes the same category to all segments of the same
  10. original line. As the attribute table is linked to the features with
  11. their category as key, all segments originating from the same original
  12. line are linked to the same line in the original attribute table which
  13. is just copied to the new map.
  14. <h3>Notes on individual segment information</h3>
  15. When running <em>v.to.db</em> on a map produced by <em>v.split</em>,
  16. <em>v.to.db</em> will add length information for each segment in its
  17. respective attribute line, but since all the segments of the same
  18. original line share the same attribute table line, it only gets
  19. updated once.
  20. <p>
  21. To obtain the length of each segment, the user will have to attribute
  22. different category values to each of them. The best way to do this on
  23. a separate layer, using <em>v.category</em>
  24. <div class="code"><pre>
  25. v.category v_split op=add layer=2 output=v_split_2
  26. </pre></div>
  27. and then run the following commands on the new layer 2:
  28. <div class="code"><pre>
  29. v.db.addtable v_split_2 layer=2
  30. v.db.addcolumn map=v_split_2 column="length double precision" layer=2
  31. v.to.db map=v_split_2 type=line option=length columns=length units=meters layer=2
  32. </pre></div>
  33. To link the new segments in the new layer to the original segments, use:
  34. <div class="code"><pre>
  35. v.db.addcolumn map=v_split_2 layer=2 column="cat_1 int"
  36. v.to.db map=v_split_2 layer=2 option=query query_layer=1 query_column=cat columns=cat_1
  37. </pre></div>
  38. <h2>EXAMPLES</h2>
  39. The examples are based on the North Carolina sample data location.
  40. <h3>Example 1: Inserting nodes to railroad lines map</h3>
  41. <div class="code"><pre>
  42. # extract one railroad line for this example
  43. v.extract input=railroads output=myrr cats=1
  44. # show line, category, direction (to find the beginning)
  45. g.region vector=myrr
  46. d.erase
  47. d.vect myrr display=shape,cat,dir
  48. # insert nodes at a distance not longer than 1000m
  49. v.split input=myrr output=myrr_split_1km length=1000
  50. d.vect myrr_split_1km display=shape,topo
  51. </pre></div>
  52. <p>
  53. Note: In case that the vector line data are not polylines,
  54. generate first polylines as the second step, eg.:
  55. <div class="code"><pre>
  56. # join segments into polyline
  57. v.build.polylines input=myrr output=myrr_polylines
  58. # regenerate categories
  59. v.category input=myrr_polylines output=myrailroads option=add
  60. </pre></div>
  61. <h3>Example 2: Inserting vertices to railroad lines map</h3>
  62. Note: first run the two steps from example 1.
  63. <div class="code"><pre>
  64. # insert vertices at a distance not longer than 1000m
  65. v.split -n input=myrr output=myrr_split length=1000
  66. d.vect myrr_split display=shape,topo
  67. </pre></div>
  68. <h2>SEE ALSO</h2>
  69. <em>
  70. <a href="v.edit.html">v.edit</a>,
  71. <a href="v.build.polylines.html">v.build.polylines</a>,
  72. <a href="v.to.points.html">v.to.points</a>,
  73. <a href="v.segment.html">v.segment</a>
  74. </em>
  75. <h2>AUTHOR</h2>
  76. Radim Blazek
  77. <!--
  78. <p>
  79. <i>Last changed: $Date$</i>
  80. -->