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

LERC unsupported with 1.3.0 #94

Closed
ajnisbet opened this issue Oct 18, 2022 · 5 comments
Closed

LERC unsupported with 1.3.0 #94

ajnisbet opened this issue Oct 18, 2022 · 5 comments

Comments

@ajnisbet
Copy link

rasterio 1.2.10 supported reading from LERC-encoded rasters, but this no longer works since 1.3.0.

Here's a minimal Dockerfile that triggers the error:

FROM python:3.9.14-bullseye
COPY lerc.tif .
RUN pip install rasterio==1.3.2
RUN python -c "import rasterio; f = rasterio.open('lerc.tif'); print(f.read())"

fails with

Traceback (most recent call last):
  File "rasterio/_base.pyx", line 302, in rasterio._base.DatasetBase.__init__
  File "rasterio/_base.pyx", line 213, in rasterio._base.open_dataset
  File "rasterio/_err.pyx", line 217, in rasterio._err.exc_wrap_pointer
rasterio._err.CPLE_AppDefinedError: lerc.tif: Cannot open TIFF file due to missing codec.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/local/lib/python3.9/site-packages/rasterio/env.py", line 442, in wrapper
    return f(*args, **kwds)
  File "/usr/local/lib/python3.9/site-packages/rasterio/__init__.py", line 277, in open
    dataset = DatasetReader(path, driver=driver, sharing=sharing, **kwargs)
  File "rasterio/_base.pyx", line 304, in rasterio._base.DatasetBase.__init__
rasterio.errors.RasterioIOError: lerc.tif: Cannot open TIFF file due to missing codec.

versions 1.3.0 to 1.3.2 inclusive fail, 1.2.10 works fine.

The raster is encoded with

Image Structure Metadata:
  COMPRESSION=LERC
  INTERLEAVE=BAND
  LERC_VERSION=2.4

using GDAL 3.3.1 (installed with conda on ubuntu).

@sgillies
Copy link
Member

@ajnisbet that I can recall, we've never intentionally supported LERC. See for example #70. Is it possible that you were previously installing rasterio from the conda-forge channel?

@ajnisbet
Copy link
Author

The dockerfile pulls in the pypi wheel: LERC works with

rasterio-1.2.10-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl

and not with

rasterio-1.3.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

And even going back to 1.1.0 and python3.7 with rasterio-1.1.0-cp37-cp37m-manylinux1_x86_64.whl supports LERC

FROM python:3.7
COPY lerc.tif .
RUN pip install rasterio==1.1.0
RUN python -c "import rasterio; f = rasterio.open('lerc.tif'); print(f.read())"

It looks like the user from #70 is using conda-forge (rasterio/rasterio#2270) not the wheels.


Anyway, if LERC isn't explicitly supported by the rasterio wheels that's fine, just wanted you to be aware of the potential regression!

It doesn't even actually effect me: I briefly used LERC a while ago before realising that zstd was about the same size and faster (and lossless!) and I had some leftover tests which started failing at 1.3.0. I just removed the tests, I've never seen LERC anywhere else in the wild.

@sgillies
Copy link
Member

@ajnisbet thanks for the follow up! I suspect that a switch in this project from using GDAL's internal libtiff (which might have vendored LERC) to a system libtiff (shared with PROJ) is involved.

@ajnisbet
Copy link
Author

Makes sense, I'll close the issue as it sounds like this is a (understandable) wontfix. Thanks for all your work on rasterio!

@mmcfarland
Copy link

We recently came across this behavior while attempting to upgrade rasterio and the titiler stack within the Microsoft Planetary Computer. We have about 380k LERC COGs and so are also interested in rasterio support (our setup previously worked, likely as described in this issue). Thanks for your work on this, and we'll keep an eye on #100.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants