kopia lustrzana https://github.com/OpenDroneMap/ODM
Add more gdal creation options
rodzic
cee7b63312
commit
d4d09cbc3f
|
@ -315,6 +315,29 @@ def config():
|
||||||
help=('Orthophoto ground resolution in pixels/meter'
|
help=('Orthophoto ground resolution in pixels/meter'
|
||||||
'Default: %(default)s'))
|
'Default: %(default)s'))
|
||||||
|
|
||||||
|
parser.add_argument('--orthophoto-target-srs',
|
||||||
|
metavar="<EPSG:XXXX>",
|
||||||
|
type=str,
|
||||||
|
default=None,
|
||||||
|
help='Target spatial reference for orthophoto creation. '
|
||||||
|
'Not implemented yet.\n'
|
||||||
|
'Default: %(default)s')
|
||||||
|
|
||||||
|
parser.add_argument('--orthophoto-no-tiled',
|
||||||
|
action='store_true',
|
||||||
|
default=False,
|
||||||
|
help='Set this parameter if you want a stripped geoTIFF.\n'
|
||||||
|
'Default: %(default)s')
|
||||||
|
|
||||||
|
parser.add_argument('--orthophoto-compression',
|
||||||
|
metavar='<STRING>',
|
||||||
|
type=str,
|
||||||
|
choices=['JPEG','LZW','PACKBITS','DEFLATE','LZMA','NONE'],
|
||||||
|
default='DEFLATE',
|
||||||
|
help='Set the compression to use. Note that this could '
|
||||||
|
'break gdal_translate if you don\'t know what you '
|
||||||
|
'are doing. Options: %(choices)s.\nDefault: %(default)s')
|
||||||
|
|
||||||
parser.add_argument('--zip-results',
|
parser.add_argument('--zip-results',
|
||||||
action='store_true',
|
action='store_true',
|
||||||
default=defaultSettings['zip_results'],
|
default=defaultSettings['zip_results'],
|
||||||
|
|
|
@ -73,6 +73,9 @@ class ODMApp(ecto.BlackBox):
|
||||||
use_exif=p.args.use_exif,
|
use_exif=p.args.use_exif,
|
||||||
verbose=p.args.verbose),
|
verbose=p.args.verbose),
|
||||||
'orthophoto': ODMOrthoPhotoCell(resolution=p.args.orthophoto_resolution,
|
'orthophoto': ODMOrthoPhotoCell(resolution=p.args.orthophoto_resolution,
|
||||||
|
t_srs=p.args.orthophoto_target_srs,
|
||||||
|
no_tiled=p.args.orthophoto_no_tiled,
|
||||||
|
compress=p.args.orthophoto_compression,
|
||||||
verbose=p.args.verbose)
|
verbose=p.args.verbose)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,9 @@ from opendm import types
|
||||||
class ODMOrthoPhotoCell(ecto.Cell):
|
class ODMOrthoPhotoCell(ecto.Cell):
|
||||||
def declare_params(self, params):
|
def declare_params(self, params):
|
||||||
params.declare("resolution", 'Orthophoto ground resolution in pixels/meter', 20)
|
params.declare("resolution", 'Orthophoto ground resolution in pixels/meter', 20)
|
||||||
|
params.declare("t_srs", 'Target SRS', None)
|
||||||
|
params.declare("no_tiled", 'Do not tile tiff', False)
|
||||||
|
params.declare("compress", 'Compression type', 'DEFLATE')
|
||||||
params.declare("verbose", 'print additional messages to console', False)
|
params.declare("verbose", 'print additional messages to console', False)
|
||||||
|
|
||||||
def declare_io(self, params, inputs, outputs):
|
def declare_io(self, params, inputs, outputs):
|
||||||
|
@ -93,20 +96,26 @@ class ODMOrthoPhotoCell(ecto.Cell):
|
||||||
'uly': uly,
|
'uly': uly,
|
||||||
'lrx': lrx,
|
'lrx': lrx,
|
||||||
'lry': lry,
|
'lry': lry,
|
||||||
|
'tiled': '' if self.params.no_tiled else '-co TILED=yes ',
|
||||||
|
'compress': self.params.compress,
|
||||||
|
'predictor': '-co PREDICTOR=2 ' if self.params.compress in
|
||||||
|
['LZW', 'DEFLATE'] else '',
|
||||||
'epsg': georef.epsg,
|
'epsg': georef.epsg,
|
||||||
|
't_srs': self.params.t_srs or "EPSG:{0}".format(georef.epsg),
|
||||||
'png': tree.odm_orthophoto_file,
|
'png': tree.odm_orthophoto_file,
|
||||||
'tiff': tree.odm_orthophoto_tif,
|
'tiff': tree.odm_orthophoto_tif,
|
||||||
'log': tree.odm_orthophoto_tif_log
|
'log': tree.odm_orthophoto_tif_log
|
||||||
}
|
}
|
||||||
|
|
||||||
system.run('gdal_translate -a_ullr {ulx} {uly} {lrx} {lry} '
|
system.run('gdal_translate -a_ullr {ulx} {uly} {lrx} {lry} '
|
||||||
'-co TILED=yes '
|
'{tiled} '
|
||||||
'-co COMPRESS=DEFLATE '
|
'-co COMPRESS={compress} '
|
||||||
'-co PREDICTOR=2 '
|
'{predictor} '
|
||||||
'-co BLOCKXSIZE=512 '
|
'-co BLOCKXSIZE=512 '
|
||||||
'-co BLOCKYSIZE=512 '
|
'-co BLOCKYSIZE=512 '
|
||||||
'-co NUM_THREADS=ALL_CPUS '
|
'-co NUM_THREADS=ALL_CPUS '
|
||||||
'-a_srs \"EPSG:{epsg}\" {png} {tiff} > {log}'.format(**kwargs))
|
'-a_srs \"EPSG:{epsg}\" '
|
||||||
|
'{png} {tiff} > {log}'.format(**kwargs))
|
||||||
geotiffcreated = True
|
geotiffcreated = True
|
||||||
if not geotiffcreated:
|
if not geotiffcreated:
|
||||||
log.ODM_WARNING('No geo-referenced orthophoto created due '
|
log.ODM_WARNING('No geo-referenced orthophoto created due '
|
||||||
|
|
Ładowanie…
Reference in New Issue