RangeError: Invalid typed array length
Hello, when I try to load a full raster with fromUrl I have a RangeError. If I try to load only one tile, there is no problem. Seem like than when the Uint8Array is created, it's length is negative. Is it a know issue, and did I made a mistake when I load the raster ?
Hi @Zvarrit Thanks for raising this issue.
Is it a know issue,
No, typically this should work.
and did I made a mistake when I load the raster ?
I cannot tell, I did not see the code you are using to read the data.
Can you provide more information? Could you maybe share the TIFF that is causing the problem? Also very helpful is a stacktrace of the error, the tiffdump or a gdalinfo.
I'll close this issue now, reopen please when there is more information available.
Sorry for the delay, I'm using PHP for getting the raster of a database. I declare a header to make it a tiff file, and use directly the php link with the "fromUrl" function. If I directly use it, I have a RangeError. However, if I first download the result then use the result with "fromUrl", it work.
Hi @constantinius, attached are two sample files with 2 bands (GFS wind u,v) generated with GDAL 3.3.0.
Code used to read them:
const geotiff = await GeoTIFF.fromUrl(url, { allowFullFile: true });
const geotiffImage = await geotiff.getImage(0);
const sourceData = await geotiffImage.readRasters({ interleave: true });
Result:
2021110917.tif.zip - RangeError: Invalid typed array length: -dddd (negative number)
2021110918.tif.zip - works fine
The same error happens with single-band files.
Could you take a look what's the difference between the two attached files, please? GDAL and QGIS opens them both fine.
Will have a look