Hi! I’m wondering how I can read a gdal dataset that comes in the form of some io stream. Imagine you iterate over a tar file of tifs via TarIterator. For each tif there is an io stream containing the raw dataset data as on the disk. I don’t want to use the /vsitar/ interface, because that has to scan the tar up to the desired file. Does anyone have an idea?
I believe it should be possible (consuming the stream though, as the length need to be known for GDAL), but it’s not a standard feature in ArchGDAL. In fact, you have to dive to GDAL, calling something like vsifilefrommembuffer
, registring it as "/vsimem/something"
, and then normally opening with read("vsimem/something")
.
Feel free to make a PR exposing this functionality in ArchGDAL
Thank you! This does the trick, indeed:
GDAL.vsifilefrommembuffer("/vsimem/test", data, length(data), false)
Where data is of type Vector{UInt8} and the /vsimem/ part of the path is important.