[GRASS-SVN] r53273 - grass/trunk/vector/v.to.points
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Sep 26 10:10:31 PDT 2012
Author: marisn
Date: 2012-09-26 10:10:31 -0700 (Wed, 26 Sep 2012)
New Revision: 53273
Modified:
grass/trunk/vector/v.to.points/main.c
grass/trunk/vector/v.to.points/v.to.points.html
Log:
v.to.points allow to use llayer -1 to convert features without category (i.e. boundaries)
Modified: grass/trunk/vector/v.to.points/main.c
===================================================================
--- grass/trunk/vector/v.to.points/main.c 2012-09-26 13:24:24 UTC (rev 53272)
+++ grass/trunk/vector/v.to.points/main.c 2012-09-26 17:10:31 UTC (rev 53273)
@@ -48,8 +48,13 @@
/* Write point */
Vect_append_point(PPoints, x, y, z);
- Vect_cat_set(PCats, 1, line_cat);
- Vect_cat_set(PCats, 2, point_cat);
+ if (line_cat > 0) {
+ Vect_cat_set(PCats, 1, line_cat);
+ Vect_cat_set(PCats, 2, point_cat);
+ }
+ else {
+ Vect_cat_set(PCats, 1, point_cat);
+ }
Vect_write_line(Out, GV_POINT, PPoints, PCats);
/* Attributes */
@@ -319,8 +324,11 @@
ltype = Vect_read_line(&In, LPoints, LCats, line);
if (!(ltype & type))
continue;
- if (!Vect_cat_get(LCats, field, &cat))
+ if (!Vect_cat_get(LCats, field, &cat) && field != -1)
continue;
+ // Assign CAT for layer 0 objects (i.e. boundaries)
+ if (field == -1)
+ cat = -1;
if (LPoints->n_points <= 1) {
write_point(&Out, LPoints->x[0], LPoints->y[0], LPoints->z[0],
Modified: grass/trunk/vector/v.to.points/v.to.points.html
===================================================================
--- grass/trunk/vector/v.to.points/v.to.points.html 2012-09-26 13:24:24 UTC (rev 53272)
+++ grass/trunk/vector/v.to.points/v.to.points.html 2012-09-26 17:10:31 UTC (rev 53273)
@@ -1,18 +1,22 @@
<h2>DESCRIPTION</h2>
-<em>v.to.points</em> creates points along input lines. The output is a vector with 2 layers.
+<p><em>v.to.points</em> creates points along input lines. The output is a vector with 2 layers.
Layer 1 holds the category and attributes of the input lines; all points created along the
same line have the same category, equal to the category of that line. In layer 2 each point
has it's unique category; other attributes stored in layer 2 are <em>lcat</em> - the
-category of the input line and <em>along</em> - the distance from line's start.
+category of the input line and <em>along</em> - the distance from line's start.</p>
<h2>NOTES</h2>
-The <em>dmax</em> parameter is the maximum limit but not an exact
+<p>The <em>dmax</em> parameter is the maximum limit but not an exact
distance. To place points with exact distance from the beginning
of the vector line the user should use
-<a href="v.segment.html">v.segment</a>.
+<a href="v.segment.html">v.segment</a>.</p>
+<p>Set llayer to -1 to ignore object category values. Objects will be assigned
+new unique categories at layer 1. llayer -1 should be used to convert boundaries,
+as in most of cases boundaries lack category values.</p>
+
<p>The <em>type</em> parameter is used to control which input vector
geometry types to convert into points.
Some caveats to consider about this parameter:
@@ -43,30 +47,31 @@
the output vector for <em>type=area</em>.</li>
</ul>
-The -v flag is used to digitize points that fall on the line's vertices <em>only</em>.
-<em>dmax</em> is ignored in this case.
+<p>The -v flag is used to digitize points that fall on the line's vertices <em>only</em>.
+<em>dmax</em> is ignored in this case.</p>
<p>If the -i flag is used in conjunction with the -v flag,
<em>v.to.points</em> will digitize points on the line vertices, as
well as interpolate points between line vertices using <em>dmax</em>
-as the maximum allowable spacing.
+as the maximum allowable spacing.</p>
<p>To get points created for the beginning, middle and end only, use
-the -i switch and set <em>dmax</em> so that:
-<p> (length of input line / 2) <= <em>dmax</em> <= length of input line
-<p>So if <em>dmax</em> is between 0.5x and 1.0x the line length, you
+the -i switch and set <em>dmax</em> so that: <br>
+ (length of input line / 2) <= <em>dmax</em> <= length of input line
+So if <em>dmax</em> is between 0.5x and 1.0x the line length, you
will always get points created at exactly the beginning, middle and
-end of the input line.
+end of the input line.</p>
<h2>EXAMPLE</h2>
-In this example, the 't_powerlines' vector lines map in the
+<p>In this example, the 't_powerlines' vector lines map in the
<a href="http://grass.osgeo.org/download/data6.php">Spearfish 6</a>
-location is used to create points along the input lines:
+location is used to create points along the input lines:</p>
<div class="code"><pre>
v.to.points in=t_powerlines out=t_powerlines_points dmax=120
d.vect t_powerlines_points
</pre></div>
-
+
+
<h2>SEE ALSO</h2>
<em>
@@ -78,4 +83,4 @@
Radim Blazek
-<p><i>Last changed: $Date$</i>
+<p><i>Last changed: $Date$</i></p>
More information about the grass-commit
mailing list