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
860 stars 181 forks source link

Support sparse tiff files #305

Open otfried opened 2 years ago

otfried commented 2 years ago

This adds support for sparse tiff files, where the tiff file contains tiles or strips with both index and byte count set to zero.

When reading such a tile, we create an array of the appropriate type and size, and fill it with the GDAL nodata value if that is set, or otherwise with zero, as specified in https://gdal.org/drivers/raster/gtiff.html#sparse-files.

Includes some tests with 8-bit and 16-bit sparse tiff files.

Closes #304