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
866 stars 182 forks source link

BlockedSource: Duplicated HTTP range requests #427

Open sguimmara opened 6 months ago

sguimmara commented 6 months ago

We are using geotiff.js to retrieve COG data in Giro3D, as seen in this example: https://giro3d.org/examples/cog_elevation.html

Many times, we see that the exact same request is sent by geotiff.js: same URL, same Content-Range and Content-Length headers, resulting in a massive increase of the data to download. Depending on the compression used, and the bitness of the image, the increase can be catastrophic.

The displayed terrain is subdivided in a hierarchical grid, meaning that there will be some overlap between grid cells and COG tiles: the same COG tiles will be shared among neighbour cells. Now I expect that the BlockedSource deduplicate requests for the same slice of data, but it seems that it does not (or at least not always).

image