Topics

LERC Compression Error

calebrob6@...
 

Hello all,

I have a raster that uses LERC compression. Opening/reading from the raster works fine, however I get the following error when trying to access the `.profile` property:
ValueError: 'LERC' is not a valid Compression

I've found that simply adding `lerc = 'LERC'` to the Compression enum in rasterio/enums.py solves this problem. Is this the correct fix and if so, would you like me to open a pull request for it?

Thanks,
Caleb

Sean Gillies
 

Hi Caleb,

Sure, a PR would be welcome. This compression algorithm isn't available in a GDAL release yet, but it doesn't do any harm to have it enumerated in Rasterio. Behavior for Rasterio 1.0.0 and GDAL 2.2.4 is this:

$ rio convert tests/data/RGB.byte.tif /tmp/lerc.tif --co compress=LERC
WARNING:rasterio._gdal:CPLE_NotSupported in 'LERC' is an unexpected value for COMPRESS creation option of type string-select.
WARNING:rasterio._gdal:CPLE_IllegalArg in COMPRESS=LERC value not recognised, ignoring.

On Wed, Jul 18, 2018 at 7:45 PM, <calebrob6@...> wrote:
Hello all,

I have a raster that uses LERC compression. Opening/reading from the raster works fine, however I get the following error when trying to access the `.profile` property:
ValueError: 'LERC' is not a valid Compression

I've found that simply adding `lerc = 'LERC'` to the Compression enum in rasterio/enums.py solves this problem. Is this the correct fix and if so, would you like me to open a pull request for it?

Thanks,
Caleb




--
Sean Gillies