[GRASS-SVN] r66242 - grass-addons/grass7/vector/v.lidar.mcc

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Sep 16 07:12:53 PDT 2015


Author: wenzeslaus
Date: 2015-09-16 07:12:53 -0700 (Wed, 16 Sep 2015)
New Revision: 66242

Modified:
   grass-addons/grass7/vector/v.lidar.mcc/v.lidar.mcc.py
Log:
v.lidar.mcc: copy instead of merging into an empty vector

When vector map is created with v.edit it is empty and 2D. Merging 3D
vector map into the empty one using v.patch produces 2D vector map
and a warning.

Now both ground and also non-ground vetor maps are 3D.
The price is one if in the main code - the inner loop (negligible here).


Modified: grass-addons/grass7/vector/v.lidar.mcc/v.lidar.mcc.py
===================================================================
--- grass-addons/grass7/vector/v.lidar.mcc/v.lidar.mcc.py	2015-09-16 14:01:05 UTC (rev 66241)
+++ grass-addons/grass7/vector/v.lidar.mcc/v.lidar.mcc.py	2015-09-16 14:12:53 UTC (rev 66242)
@@ -182,10 +182,10 @@
         
     # Pass ame of input map to v.outlier
     nc_points = input
-    
-    # Create output map for non-ground points
-    grass.run_command("v.edit", tool="create", map=ng_output, quiet = True )
 
+    # controls first creation of the output map before patching
+    ng_output_exists = False
+
     # Loop through scale domaines
     while ( l <= l_stop ) :
         i = 1
@@ -229,7 +229,12 @@
                 convergence = float( float(ng) / float(nc) )
                 grass.run_command('v.build', map=temp_ng, stderr=nuldev)
                 # Patch non-ground points to non-ground output map
-                grass.run_command("v.patch", input = temp_ng, output = ng_output, flags = "ab", overwrite = True, quiet = True, stderr = nuldev )
+                if ng_output_exists:
+                    grass.run_command('v.patch', input=temp_ng, output=ng_output, flags="ab",
+                                      overwrite=True, quiet=True, stderr=nuldev)
+                else:
+                    grass.run_command('g.copy', vector=(temp_ng, ng_output), stderr=nuldev)
+                    ng_output_exists = True
             else :
                 convergence = 0
             # Give information on convergence level



More information about the grass-commit mailing list