-
Notifications
You must be signed in to change notification settings - Fork 86
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Author of Proposal: @brendan
Reason or problem
LERC (Limited Error Raster Compression, TIFF tag 34887) is Esri's codec built for raster data. The interesting thing about it is controlled-error lossy mode: you set a maximum error tolerance (e.g. 0.01 meters for an elevation raster) and LERC compresses to that bound. None of our codecs can do this.
LERC shows up in ArcGIS exports and COGs served from ArcGIS Image Server. Without LERC support, those files can't be read by our geotiff package at all.
Proposal
Design:
CPU-only (no GPU library exists for LERC):
_compression.py:COMPRESSION_LERC = 34887, decompress/compress via thelercPython package,LERC_AVAILABLEflag_writer.py: Add'lerc'to_compression_tag()- Expose a
max_z_errorparameter for the lossy tolerance (0 = lossless) - Hook into
decompress()and handle in the strip/tile writers
The lerc Python package wraps Esri's C library.
Usage:
# Lossless
write_geotiff(data, "dem.tif", compression="lerc")
# Lossy with 0.01m max error, much smaller file for elevation data
write_geotiff(data, "dem.tif", compression="lerc", lerc_max_z_error=0.01)
da = read_geotiff("esri_server.tif") # auto-detects LERCStakeholders and impacts
Users working with elevation data, ArcGIS exports, or ArcGIS Image Server COGs. Additive.
Drawbacks
- CPU only, no GPU path available
lercpackage depends on the LERC C library- Less widely supported than deflate/LZW outside the Esri ecosystem
Alternatives
- JPEG 2000 lossy mode exists but doesn't guarantee a max error bound on pixel values
- Deflate is lossless but can't match LERC's compression ratios with controlled error
Unresolved questions
- How to expose
max_z_errorin the public API (keyword arg? compression options dict?) - Whether to support LERC+ZSTD (some implementations compress the LERC output with ZSTD on top)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request