[GRASS-SVN] r64003 - grass-addons/grass7/vector/v.transects

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Jan 8 10:19:01 PST 2015


Author: annakrat
Date: 2015-01-08 10:19:01 -0800 (Thu, 08 Jan 2015)
New Revision: 64003

Modified:
   grass-addons/grass7/vector/v.transects/v.transects.html
   grass-addons/grass7/vector/v.transects/v.transects.py
Log:
v.transects: add l flag to create transect from the last point

Modified: grass-addons/grass7/vector/v.transects/v.transects.html
===================================================================
--- grass-addons/grass7/vector/v.transects/v.transects.html	2015-01-08 18:11:43 UTC (rev 64002)
+++ grass-addons/grass7/vector/v.transects/v.transects.html	2015-01-08 18:19:01 UTC (rev 64003)
@@ -3,6 +3,9 @@
 <em>v.transects</em> creates equally spaced geometries along 
 input lines. The geometries can be lines or quadrilateral areas. Lines 
 and areas are generated to be perpendicular to the input line. 
+By default the last point of each line is not used
+because the last transect distance would be typically different from the previous once.
+To create a transect from the last point, use flag <b>-l</b>.
 
 <h2>NOTES</h2>
 
@@ -22,8 +25,8 @@
 Location or the
 <a href="http://courses.ncsu.edu/mea792/common/media/gisdemo.zip">gisdemo (47MB)</a>
 Location.
+
  
-
 <h3>Example 1) - Generate line transects along shoreline</h3>
 
 <p>Generate 20 cross-shore transects along 2008 shoreline (1m contour)

Modified: grass-addons/grass7/vector/v.transects/v.transects.py
===================================================================
--- grass-addons/grass7/vector/v.transects/v.transects.py	2015-01-08 18:11:43 UTC (rev 64002)
+++ grass-addons/grass7/vector/v.transects/v.transects.py	2015-01-08 18:19:01 UTC (rev 64003)
@@ -47,6 +47,10 @@
 #% options: point,line,area
 #% answer: line
 #%end
+#%flag
+#% key: l
+#% description: Use the last point of the line to create transect
+#%end
 
 from subprocess import Popen, PIPE, STDOUT
 from numpy import array
@@ -117,7 +121,7 @@
     return v
 
 
-def get_transects_locs(vector, transect_spacing):
+def get_transects_locs(vector, transect_spacing, last_point):
     """!Get transects locations along input vector lines."""
     # holds locations where transects should intersect input vector lines
     transect_locs = []
@@ -139,6 +143,8 @@
                 line[i] = transect_locs[-1][-1]
             else:
                 j += 1
+        if last_point:
+            transect_locs[-1].append(line[j-1])
     return transect_locs
 
 
@@ -247,6 +253,7 @@
     dleft = options['dleft']
     dright = options['dright']
     shape = options['type']
+    last_point = flags['l']
 
     if not dleft:
         dleft = transect_spacing
@@ -279,7 +286,7 @@
 
     #################################
     v = loadVector(vector)
-    transect_locs = get_transects_locs(v, transect_spacing)
+    transect_locs = get_transects_locs(v, transect_spacing, last_point)
     temp_map = tempmap()
     if shape == 'line' or not shape:
         transect_ends = get_transect_ends(transect_locs, dleft, dright)



More information about the grass-commit mailing list