Closed RoymanLuo closed 1 year ago
I did some research on this, and it is a regression introduced by #284. Also, running the test page (npm run dev
) on http://localhost:8090/test/ shows the same error messages, as well as an OpenLayers example (https://github.com/geotiffjs/geotiff.js/pull/284#issuecomment-1120473072).
It turns out that as soon as the block cache is full, this issue occurs. A workaround is to set a huge cacheSize
, but that's not a solution.
This means that since #284, geotiff.js is seriously broken.
The reason is that pending block loads are not protected from being evicted from the cache. I'm trying to fix this right now, hoping to have a pull request ready soon.
The missing blocks that trigger the error were indeed evicted from the cache before being used. See #336 for the fix.
when I use a tif file which height is 1401, it would console this error when readRasters
at BlockedSource.fetch (blockedsource.js?2917:142:1)
at async GeoTIFFImage.getTileOrStrip (geotiffimage.js?ae25:384:1)
at async Promise.all (:8080/index 1)
at async GeoTIFFImage._readRaster (geotiffimage.js?ae25:516:1)
at async GeoTIFFImage.readRasters (geotiffimage.js?ae25:610:1)
at async readGeotiff (useGeotiff.js?9243:11:1)
What can I do to solve this problem ?const tif = await GeoTIFF.fromUrl('./dem.tif')
const tifImage = await tif.getImage()
const image = {
width: tifImage.getWidth(),
height: tifImage.getHeight()
}
const pool = new GeoTIFF.Pool();
const data = await tifImage.readRasters({
interleave: true,
pool
})