geotiffjs / geotiff.js

geotiff.js is a small library to parse TIFF files for visualization or analysis. It is written in pure JavaScript, and is usable in both the browser and node.js applications.
https://geotiffjs.github.io/
MIT License
845 stars 175 forks source link

Reading files larger than 4gb? #402

Open max-mapper opened 8 months ago

max-mapper commented 8 months ago

Sorry if this has been asked before, I searched and could not find it. Thank you for the great library. I have a BigTiff file that is 21GB. I can open it in QGIS and read it with gdal etc without a problem. But due to the 4gb limitation of ArrayBuffer I don't understand how to read it using geotiff.js, for example:

> new Uint8Array(new ArrayBuffer(4294967296))
Uint8Array(4294967296)

is ok but

> new Uint8Array(new ArrayBuffer(4294967297))
Uncaught RangeError: Invalid typed array length: undefined
    at new Uint8Array (<anonymous>)

throws an exception. It seems like this library is designed to load an entire file into a single ArrayBuffer, as opposed to being passed a file descriptor and reading the parts it needs into memory as needed, is that correct? If so, what is the point of BigTiff support if files larger than 4gb cannot be read? Thank you

jcphill commented 6 months ago

You can use fromBlob() to load directly from a File object on demand.