[GRASS-SVN] r62677 - grass-addons/grass7/vector/v.fixed.segmentpoints
svn_grass at osgeo.org
svn_grass at osgeo.org
Sun Nov 9 02:34:56 PST 2014
Author: hellik
Date: 2014-11-09 02:34:56 -0800 (Sun, 09 Nov 2014)
New Revision: 62677
Modified:
grass-addons/grass7/vector/v.fixed.segmentpoints/v.fixed.segmentpoints.py
Log:
v.fixed.segmentpoints: add coordinates to attribute table
Modified: grass-addons/grass7/vector/v.fixed.segmentpoints/v.fixed.segmentpoints.py
===================================================================
--- grass-addons/grass7/vector/v.fixed.segmentpoints/v.fixed.segmentpoints.py 2014-11-09 09:53:12 UTC (rev 62676)
+++ grass-addons/grass7/vector/v.fixed.segmentpoints/v.fixed.segmentpoints.py 2014-11-09 10:34:56 UTC (rev 62677)
@@ -118,7 +118,7 @@
distancesrange_without_end = range(0, int(max_distancerange), int(sdistance))
# Write segment point input file for g.segment to G_OPT_M_DIR
- grass.message( "Write segment point input file for g.segment" )
+ grass.message( "Write segment point input file for g.segment ..." )
segment_points_file = os.path.join( directory, fpoints )
file = open(segment_points_file, 'a')
for f, b in zip(segmentpointsrange_without_end, distancesrange_without_end):
@@ -135,21 +135,33 @@
grass.message( "----" )
# Run v.segment with the segment point input
-
+ grass.message( "Run v.segment ..." )
grass.run_command("v.segment", input = 'vlinesingle',
output = 'segmentpoints',
file = segment_points_file)
grass.run_command("v.db.addtable", map = 'segmentpoints')
+ grass.message( "----" )
+
+ # Adding coordinates to segment points attribute table.
+ grass.message( "Adding coordinates to segment points attribute table ..." )
+
+ grass.run_command("v.db.addcolumn", map = 'segmentpoints',
+ layer = 1,
+ columns = "xcoor double,ycoor double")
-
+ grass.run_command("v.to.db", map = 'segmentpoints',
+ option = 'coor',
+ layer = 1,
+ columns = 'xcoor,ycoor')
+ grass.message( "----" )
+
# TODO join point segment file to point vector
# grass.run_command("db.in.ogr", dsn = segment_points_file,
# output = 't_segment_points_file')
- grass.message( "Segment points file created" )
+
grass.message( "----" )
-
# v.fixed.segmentpoints done!
grass.message( "v.fixed.segmentpoints done!" )
More information about the grass-commit
mailing list