[GRASS-SVN] r69691 - grass-addons/grass7/vector/v.fixed.segmentpoints

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Oct 10 09:44:53 PDT 2016


Author: hellik
Date: 2016-10-10 09:44:53 -0700 (Mon, 10 Oct 2016)
New Revision: 69691

Modified:
   grass-addons/grass7/vector/v.fixed.segmentpoints/v.fixed.segmentpoints.html
   grass-addons/grass7/vector/v.fixed.segmentpoints/v.fixed.segmentpoints.py
Log:
v.fixed.segmentpoints: add category of the input line to the segment point attribute table.
patch by Paulo van Breugel

Modified: grass-addons/grass7/vector/v.fixed.segmentpoints/v.fixed.segmentpoints.html
===================================================================
--- grass-addons/grass7/vector/v.fixed.segmentpoints/v.fixed.segmentpoints.html	2016-10-09 10:59:56 UTC (rev 69690)
+++ grass-addons/grass7/vector/v.fixed.segmentpoints/v.fixed.segmentpoints.html	2016-10-10 16:44:53 UTC (rev 69691)
@@ -1,5 +1,6 @@
 <h2>DESCRIPTION</h2>
 
+<p>
 <em>v.fixed.segmentpoints</em> creates segment points along a vector 
 line with fixed distances by using the <em>v.segment</em> module. A 
 category of one line has to be given. Start and end point of the line 
@@ -7,11 +8,18 @@
 As a <em>prefix</em> (starting with a letter) has to be given, resulting 
 vectors are <em>prefix</em>_singleline and 
 <em>prefix</em>_segmentpoints, resulting external files are 
-<em>prefix</em>_segmentpoints and <em>prefix</em>_segmentpoints.csv. The 
-next to last point may be closer to the last point as the given 
+<em>prefix</em>_segmentpoints and <em>prefix</em>_segmentpoints.csv.
+</p>
+
+<p>
+The next to last point may be closer to the last point as the given 
 distance. Distance information for every point is added to the vector 
-attribute table. The attribute is then exported as CSV file. 
+attribute table. The attribute is then exported as CSV file.
+</p>
 
+The <em>category (cat)</em> of the input line is stored in the column 
+<em>cat_line</em> of the <em>prefix</em>_segmentpoints attribute table.
+
 <h2>EXAMPLE</h2>
 
 <div class="code">

Modified: grass-addons/grass7/vector/v.fixed.segmentpoints/v.fixed.segmentpoints.py
===================================================================
--- grass-addons/grass7/vector/v.fixed.segmentpoints/v.fixed.segmentpoints.py	2016-10-09 10:59:56 UTC (rev 69690)
+++ grass-addons/grass7/vector/v.fixed.segmentpoints/v.fixed.segmentpoints.py	2016-10-10 16:44:53 UTC (rev 69691)
@@ -196,10 +196,11 @@
 									 
     grass.run_command("v.db.addcolumn", map = voutpoint,
                                      layer = 1, 
-                                     columns = "cat_2 integer,distance double")	
+                                     columns = "cat_2 integer,distance double,cat_line integer")	
 
     grass.run_command("db.execute", sql = "UPDATE %s SET cat_2 =  field_2" % (voutpoint))	
-    grass.run_command("db.execute", sql = "UPDATE %s SET distance =  field_4" % (voutpoint))										 
+    grass.run_command("db.execute", sql = "UPDATE %s SET distance =  field_4" % (voutpoint))
+    grass.run_command("db.execute", sql = "UPDATE %s SET cat_line =  %d" % (voutpoint, int(vcat)))	
     grass.run_command("db.execute", sql = "UPDATE %s SET distance =  %s WHERE cat = %s" %(voutpoint, vector_line_length, number_segmentpoints_with_end))
 	
     grass.run_command("db.dropcolumn", table = voutpoint,



More information about the grass-commit mailing list