kopia lustrzana https://github.com/OpenDroneMap/ODM
Handle split-merge of shots.geojson
rodzic
cfd78b9207
commit
42630c0f41
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
|||
0.9.8
|
||||
1.0.0
|
|
@ -93,5 +93,24 @@ def get_geojson_shots_from_opensfm(reconstruction_file, geocoords_transformation
|
|||
else:
|
||||
raise RuntimeError("%s does not exist." % reconstruction_file)
|
||||
|
||||
def merge_geojson_shots(geojson_shots_files):
|
||||
pass
|
||||
def merge_geojson_shots(geojson_shots_files, output_geojson_file):
|
||||
result = None
|
||||
added_files = {}
|
||||
for shot_file in geojson_shots_files:
|
||||
with open(shot_file, "r") as f:
|
||||
shots = json.loads(f.read())
|
||||
|
||||
if result is None:
|
||||
for feat in shots.get('features', []):
|
||||
added_files[feat['properties']['filename']] = True
|
||||
|
||||
# Use first file as base
|
||||
result = shots
|
||||
else:
|
||||
# Append features if filename not already added
|
||||
for feat in shots.get('features', []):
|
||||
if not feat['properties']['filename'] in added_files:
|
||||
result['features'].append(feat)
|
||||
|
||||
with open(output_geojson_file, "w") as f:
|
||||
f.write(json.dumps(result))
|
||||
|
|
|
@ -15,6 +15,7 @@ from opensfm.large import metadataset
|
|||
from opendm.cropper import Cropper
|
||||
from opendm.concurrency import get_max_memory
|
||||
from opendm.remote import LocalRemoteExecutor
|
||||
from opendm.shots import merge_geojson_shots
|
||||
from opendm import point_cloud
|
||||
from pipes import quote
|
||||
|
||||
|
@ -341,6 +342,20 @@ class ODMMergeStage(types.ODM_Stage):
|
|||
if args.merge in ['all', 'dem'] and args.dtm:
|
||||
merge_dems("dtm.tif", "DTM")
|
||||
|
||||
self.update_progress(95)
|
||||
|
||||
# Merge reports
|
||||
if not io.dir_exists(tree.odm_report):
|
||||
system.mkdir_p(tree.odm_report)
|
||||
|
||||
geojson_shots = tree.path(tree.odm_report, "shots.geojson")
|
||||
if not io.file_exists(geojson_shots) or self.rerun():
|
||||
geojson_shots_files = get_submodel_paths(tree.submodels_path, "odm_report", "shots.geojson")
|
||||
log.ODM_INFO("Merging %s shots.geojson files" % len(geojson_shots_files))
|
||||
merge_geojson_shots(geojson_shots_files, geojson_shots)
|
||||
else:
|
||||
log.ODM_WARNING("Found merged shots.geojson in %s" % tree.odm_report)
|
||||
|
||||
# Stop the pipeline short! We're done.
|
||||
self.next_stage = None
|
||||
else:
|
||||
|
|
Ładowanie…
Reference in New Issue