geotiff.js icon indicating copy to clipboard operation
geotiff.js copied to clipboard

Reading files larger than 4gb?

Open max-mapper opened this issue 1 year ago • 1 comments

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

max-mapper avatar Nov 07 '23 18:11 max-mapper

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

jcphill avatar Jan 26 '24 03:01 jcphill