Closed jcphill closed 2 years ago
Hi, @jcphill . Thank you for sharing this problem statement. I wasn't aware of the blob considerations. Would you be interested in submitting a PR adding the blob support to georaster?
If I implement blob support I'll submit a PR, but I can't say when that might happen due to higher priority work.
Is your feature request related to a problem? Please describe. I want to display a large GeoTIFF file on the front-end filesystem via a File (Blob) object instead of an ArrayBuffer.
Describe the solution you'd like geotiff exports a fromBlob function similar to the fromUrl and fromArrayBuffer functions currently in use. The GeoRaster constructor should detect if a Blob is passed in and call fromBlob instead of fromUrl, and likely the "if (this._url) ..." code paths will need to be taken for Blob data as well. The Blob should be assumed to be very large and only loaded into memory as needed (as with a cloud optimized GeoTIFF loaded from a URL).
Describe alternatives you've considered Using createObjectURL to create a URL string from the File object and passing the URL to parseGeoraster works on Chrome but fails on Firefox due to a bug in geotiff (https://github.com/geotiffjs/geotiff.js/issues/207). It also seems that using fromBlob would be more efficient than fetch calls to an object URL.
Additional context Loading large files from an ArrayBuffer uses lots of memory and takes several minutes to display. Loading from an object URL as described above displays almost instantly.