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.
I'm totally newbye, I found an unexpected behavior of geotiff.js, and I'm writing here just in case it is a true bug and not just some error I did in writing my code.
Uncaught (in promise) AggregateError: Request failed
at BlockedSource.fetch (blockedsource.js:153:1)
at async GeoTIFF.fromSource (geotiff.js:547:1)
Trying to debug, I noticed that in the function maybeWrapInBlockedSource (remote.js line 153), blockSize is undefined (correctly, I think, because I did not specified blocksize), but when the function compares it with null (blockSize === null) it returns false, and the function returns a new BlockedSource instead of the source itself.
When the server returns a full file instead of a block, the subsequent functions throw errors.
I resolved by adding the option allowFullFile = true, but I think it's unintuitive to have to add it in such a case... Maybe the test blockSize === null should have returned true even if blockSize is undefined? (something like blockSize == null?)
I'm totally newbye, I found an unexpected behavior of geotiff.js, and I'm writing here just in case it is a true bug and not just some error I did in writing my code.
I was trying to fetch a GeoTIFF from WCS:
But I got an error:
Trying to debug, I noticed that in the function
maybeWrapInBlockedSource
(remote.js line 153),blockSize
isundefined
(correctly, I think, because I did not specified blocksize), but when the function compares it withnull
(blockSize === null
) it returnsfalse
, and the function returns a newBlockedSource
instead of the source itself.When the server returns a full file instead of a block, the subsequent functions throw errors.
I resolved by adding the option
allowFullFile = true
, but I think it's unintuitive to have to add it in such a case... Maybe the testblockSize === null
should have returnedtrue
even ifblockSize
isundefined
? (something likeblockSize == null
?)Edit: I'm using GeoTIFF 2.0.7, webpack 5.88.1, typescript 5.1.6 and Chrome 114.0.5735.199