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