Fix COG compression, cap mesh-octree-depth values

pull/1313/head
Piero Toffanin 2021-07-03 08:46:49 -04:00
rodzic d827ee62d7
commit 7aa6444637
4 zmienionych plików z 8 dodań i 5 usunięć

Wyświetl plik

@ -5,7 +5,7 @@ from opendm.concurrency import get_max_memory
from opendm import io
from opendm import log
def convert_to_cogeo(src_path, blocksize=256, max_workers=1):
def convert_to_cogeo(src_path, blocksize=256, max_workers=1, compression="DEFLATE"):
"""
Guarantee that the .tif passed as an argument is a Cloud Optimized GeoTIFF (cogeo)
The file is destructively converted into a cogeo.
@ -30,6 +30,8 @@ def convert_to_cogeo(src_path, blocksize=256, max_workers=1):
'max_memory': get_max_memory(),
'src_path': src_path,
'tmpfile': tmpfile,
'compress': compression,
'predictor': '2' if compression in ['LZW', 'DEFLATE'] else '1',
}
try:
@ -37,7 +39,8 @@ def convert_to_cogeo(src_path, blocksize=256, max_workers=1):
"-of COG "
"-co NUM_THREADS={threads} "
"-co BLOCKSIZE={blocksize} "
"-co COMPRESS=deflate "
"-co COMPRESS={compress} "
"-co PREDICTOR={predictor} "
"-co BIGTIFF=IF_SAFER "
"-co RESAMPLING=NEAREST "
"--config GDAL_CACHEMAX {max_memory}% "

Wyświetl plik

@ -277,7 +277,7 @@ def config(argv=None, parser=None):
'Default: %(default)s'))
parser.add_argument('--mesh-octree-depth',
metavar='<positive integer>',
metavar='<integer: 1 <= x <= 14>',
action=StoreValue,
default=11,
type=int,

Wyświetl plik

@ -86,7 +86,7 @@ def post_orthophoto_steps(args, bounds_file_path, orthophoto_file, orthophoto_ti
generate_orthophoto_tiles(orthophoto_file, orthophoto_tiles_dir, args.max_concurrency)
if args.cog:
convert_to_cogeo(orthophoto_file, max_workers=args.max_concurrency)
convert_to_cogeo(orthophoto_file, max_workers=args.max_concurrency, compression=args.orthophoto_compression)
def compute_mask_raster(input_raster, vector_mask, output_raster, blend_distance=20, only_max_coords_feature=False):
if not os.path.exists(input_raster):

Wyświetl plik

@ -42,7 +42,7 @@ class ODMApp:
filterpoints = ODMFilterPoints('odm_filterpoints', args, progress=52.0)
meshing = ODMeshingStage('odm_meshing', args, progress=60.0,
max_vertex=args.mesh_size,
oct_tree=args.mesh_octree_depth,
oct_tree=max(1, min(14, args.mesh_octree_depth)),
samples=1.0,
point_weight=4.0,
max_concurrency=args.max_concurrency,