[WIP] Added steps to include TIFFTAG data in the output .tif

pull/1797/head
Stephen Winn 2024-08-20 16:51:59 +09:00
rodzic 0f89fa8385
commit 4734d8838f
4 zmienionych plików z 21 dodań i 0 usunięć

Wyświetl plik

@ -1,3 +1,4 @@
import rasterio
def get_dem_vars(args):
return {
@ -8,3 +9,10 @@ def get_dem_vars(args):
'BIGTIFF': 'IF_SAFER',
'NUM_THREADS': args.max_concurrency,
}
def update_tags(dem_file):
# - Update the geotiff tags in place using rasterio
with rasterio.open(dem_file, 'r+') as rst:
rst.update_tags(TIFFTAG_DATETIME='2024:01:01 00:00+00:00')
rst.update_tags(TIFFTAG_SOFTWARE='OpenDroneMap')

Wyświetl plik

@ -27,6 +27,13 @@ def get_orthophoto_vars(args):
'NUM_THREADS': args.max_concurrency
}
def update_tags(orthophoto_file):
# - Update the geotiff tags in place using rasterio
with rasterio.open(orthophoto_file, 'r+') as rst:
rst.update_tags(TIFFTAG_DATETIME='2024:01:01 00:00+00:00')
rst.update_tags(TIFFTAG_SOFTWARE='OpenDroneMap')
def build_overviews(orthophoto_file):
log.ODM_INFO("Building Overviews")
kwargs = {'orthophoto': orthophoto_file}

Wyświetl plik

@ -80,6 +80,9 @@ class ODMDEMStage(types.ODM_Stage):
dem_geotiff_path = os.path.join(odm_dem_root, "{}.tif".format(product))
bounds_file_path = os.path.join(tree.odm_georeferencing, 'odm_georeferenced_model.bounds.gpkg')
# update dem tags
utils.update_tags(dem_geotiff_path)
if args.crop > 0 or args.boundary:
# Crop DEM
Cropper.crop(bounds_file_path, dem_geotiff_path, utils.get_dem_vars(args), keep_original=not args.optimize_disk_space)

Wyświetl plik

@ -109,6 +109,9 @@ class ODMOrthoPhotoStage(types.ODM_Stage):
'-outputCornerFile "{corners}" {bands} {depth_idx} {inpaint} '
'{utm_offsets} {a_srs} {vars} {gdal_configs} '.format(**kwargs), env_vars={'OMP_NUM_THREADS': args.max_concurrency})
# update output orthophoto tags
orthophoto.update_tags(tree.odm_orthophoto_tif)
# Create georeferenced GeoTiff
if reconstruction.is_georeferenced():
bounds_file_path = os.path.join(tree.odm_georeferencing, 'odm_georeferenced_model.bounds.gpkg')