In plain gdal
it's quite straightforward to chain multiple vsi
drivers to e.g. directly access a .tif.gz
file:
import gdal
import rasterio as rio
## just an example, no real URL
# will work
ds = gdal.Open('/vsigzip//vsicurl/https://testdata.com/testimage.tif.gz')
# won't work
ds = rio.open('/vsigzip/https://testdata.com/testimage.tif.gz')
Is it an issue with chaining or can rasterio
just not handle .gz
files?
I just ran through this and gzip support within RasterIO (v1.0.21) checks out ok. Seems you've just missed the //vsicurl
.
import rasterio as rio
ds = rio.open('/vsigzip//vsicurl/http://localhost:8000/example.tif.gz')
The http server needs to support range requests, but if it doesn't RasterIO will produce a specific error message.
Interestingly the Apache Commons VFS scheme doesn't seem to work here;
ds = rio.open('gzip+http://localhost:8000/example.tif.gz')
Produces the following. Note missing /
before vsicurl
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/ubuntu/anaconda3/envs/rasterio-env/lib/python3.7/site-packages/rasterio/env.py", line 423, in wrapper
return f(*args, **kwds)
File "/home/ubuntu/anaconda3/envs/rasterio-env/lib/python3.7/site-packages/rasterio/__init__.py", line 216, in open
s = DatasetReader(path, driver=driver, **kwargs)
File "rasterio/_base.pyx", line 215, in rasterio._base.DatasetBase.__init__
rasterio.errors.RasterioIOError: '/vsizip/vsicurl/http://localhost:8000/example.tif.gz' does not exist in the file system, and is not recognized as a supported dataset name.