Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to turn off BIGTIFF #590

Closed
wants to merge 5 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions utilities/converter/large_image_converter/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ def _generate_geotiff(inputPath, outputPath, **kwargs):
:param level: compression level for zstd, 1-22 (default is 10).
:param predictor: one of 'none', 'horizontal', 'float', or 'yes' used for
lzw and deflate.
:param bigTiff: either 'yes', 'no', 'needed', or 'safer'. Default 'safer'.
"""
from osgeo import gdal
from osgeo import gdalconst
Expand All @@ -103,15 +104,24 @@ def _generate_geotiff(inputPath, outputPath, **kwargs):
'compression': 'lzw',
'quality': 90,
'predictor': 'yes',
'bigTiff': 'safer',
}
predictor = {
yes_no = {
'none': 'NO',
'horizontal': 'STANDARD',
'float': 'FLOATING_POINT',
'no': 'NO',
'yes': 'YES',
}
predictor = {
'horizontal': 'STANDARD',
'float': 'FLOATING_POINT',
}.update(yes_no)
big_tiff = {
'needed': 'IF_NEEDED',
'safer': 'IF_SAFER',
}.update(yes_no)
options.update({k: v for k, v in kwargs.items() if v not in (None, '')})
cmdopt = ['-of', 'COG', '-co', 'BIGTIFF=YES']
cmdopt = ['-of', 'COG']
cmdopt += ['-co', 'BIGTIFF=%d' % big_tiff[options['bigTiff']]]
cmdopt += ['-co', 'BLOCKSIZE=%d' % options['tileSize']]
cmdopt += ['-co', 'COMPRESS=%s' % options['compression'].upper()]
cmdopt += ['-co', 'QUALITY=%s' % options['quality']]
Expand Down