From cae6466fe5286fb24cdf65e43bbb8120e86cd828 Mon Sep 17 00:00:00 2001 From: Piero Toffanin Date: Fri, 31 May 2019 12:25:26 -0400 Subject: [PATCH] Rerun flag --- opendm/entwine.py | 6 +++++- stages/odm_georeferencing.py | 2 +- stages/splitmerge.py | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/opendm/entwine.py b/opendm/entwine.py index 462372d9..9fef406c 100644 --- a/opendm/entwine.py +++ b/opendm/entwine.py @@ -6,13 +6,17 @@ from opendm import log from opendm import system from opendm import concurrency -def build(input_point_cloud_files, output_path, max_concurrency=8): +def build(input_point_cloud_files, output_path, max_concurrency=8, rerun=False): if len(input_point_cloud_files) == 0: log.ODM_WARNING("No input point cloud files to process") return tmpdir = io.related_file_path(output_path, postfix="-tmp") + if rerun and io.dir_exists(output_path): + log.ODM_WARNING("Removing previous EPT directory: %s" % output_path) + shutil.rmtree(output_path) + kwargs = { 'threads': max_concurrency, 'tmpdir': tmpdir, diff --git a/stages/odm_georeferencing.py b/stages/odm_georeferencing.py index d4a29367..3ae36a92 100644 --- a/stages/odm_georeferencing.py +++ b/stages/odm_georeferencing.py @@ -140,7 +140,7 @@ class ODMGeoreferencingStage(types.ODM_Stage): # EPT point cloud output if args.pc_ept: log.ODM_INFO("Creating geo-referenced Entwine Point Tile output") - entwine.build([tree.odm_georeferencing_model_laz], tree.entwine_pointcloud, max_concurrency=args.max_concurrency) + entwine.build([tree.odm_georeferencing_model_laz], tree.entwine_pointcloud, max_concurrency=args.max_concurrency, rerun=self.rerun()) if args.crop > 0: log.ODM_INFO("Calculating cropping area and generating bounds shapefile from point cloud") diff --git a/stages/splitmerge.py b/stages/splitmerge.py index 0a880a67..644f3293 100644 --- a/stages/splitmerge.py +++ b/stages/splitmerge.py @@ -179,7 +179,7 @@ class ODMMergeStage(types.ODM_Stage): try: # pdal.merge_point_clouds(all_point_clouds, tree.odm_georeferencing_model_laz, args.verbose) - entwine.build(all_point_clouds, tree.entwine_pointcloud, max_concurrency=args.max_concurrency) + entwine.build(all_point_clouds, tree.entwine_pointcloud, max_concurrency=args.max_concurrency, rerun=self.rerun()) except Exception as e: log.ODM_WARNING("Could not merge point cloud: %s (skipping)" % str(e)) else: