Skip to content

Commit

Permalink
fix: always ignore existing overviews TDE-1046 (#862)
Browse files Browse the repository at this point in the history
* fix: always ignore existing overviews TDE-1046

* docs: add explanation
  • Loading branch information
amfage authored Feb 19, 2024
1 parent 3e550af commit 900907f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions scripts/gdal/gdal_preset.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@
# An error will be raise by GDAL if it fails creating a tiff > 4GB in size
"-co",
"bigtiff=no",
# Always ignore existing overviews so they are not created from already compressed overviews
"-co",
"overviews=ignore_existing",
]

DEM_LERC = [
Expand Down Expand Up @@ -60,7 +63,7 @@
]

COMPRESS_WEBP_LOSSLESS = [
# Comppress into webp
# Compress into webp
"-co",
"compress=webp",
# Compress losslessly
Expand All @@ -79,8 +82,6 @@
# Reduce quality of overviews to 90%
"-co",
"overview_quality=90",
"-co",
"overviews=ignore_existing",
]


Expand Down
4 changes: 2 additions & 2 deletions scripts/gdal/tests/gdal_preset_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def test_preset_lzw() -> None:
assert "blocksize=512" in gdal_command
assert "num_threads=all_cpus" in gdal_command
assert "bigtiff=no" in gdal_command
assert "overviews=ignore_existing" in gdal_command

# LZW compression
assert "compress=lzw" in gdal_command
Expand All @@ -40,7 +41,6 @@ def test_preset_lzw() -> None:
assert "overview_compress=webp" in gdal_command
assert "overview_resampling=lanczos" in gdal_command
assert "overview_quality=90" in gdal_command
assert "overviews=ignore_existing" in gdal_command

assert "EPSG:2193" in gdal_command

Expand All @@ -52,6 +52,7 @@ def test_preset_dem_lerc() -> None:
assert "blocksize=512" in gdal_command
assert "num_threads=all_cpus" in gdal_command
assert "bigtiff=no" in gdal_command
assert "overviews=ignore_existing" in gdal_command

# LERC compression
assert "compress=lerc" in gdal_command
Expand All @@ -62,7 +63,6 @@ def test_preset_dem_lerc() -> None:
assert "overview_compress=webp" not in gdal_command
assert "overview_resampling=lanczos" not in gdal_command
assert "overview_quality=90" not in gdal_command
assert "overviews=ignore_existing" not in gdal_command

assert "EPSG:2193" in gdal_command

Expand Down

0 comments on commit 900907f

Please sign in to comment.