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
859 stars 179 forks source link

Support for ZSTD compressor #372

Open REASY opened 1 year ago

REASY commented 1 year ago

Currently when I try to open a ZSTD compressed GeoTIFF I'm getting the following error:

"Error: Unknown compression method identifier: 50000
    at getDecoder (http://localhost:8091/dist/main.js:16498:11)
    at GeoTIFFImage.readRasters (http://localhost:8091/dist/main.js:18190:97)
    at GeoTIFFImage.readRGB (http://localhost:8091/dist/main.js:18241:19)
    at MapView._callee3$ (http://localhost:8091/dist/main.js:1299:46)
    at tryCatch (http://localhost:8091/dist/main.js:109577:40)
    at Generator.invoke [as _invoke] (http://localhost:8091/dist/main.js:109815:22)
    at prototype.<computed> [as next] (http://localhost:8091/dist/main.js:109629:21)
    at step (http://localhost:8091/dist/main.js:1110:191)
    at http://localhost:8091/dist/main.js:1110:361"

The list of supported decoders by geotiff.js at the moment can be found here: https://github.com/geotiffjs/geotiff.js/blob/f15d7709efd5e519dc2834386305218208cecd9c/src/compression/index.js#L20-L29

50000 is a reserved identifier for ZSTD: https://github.com/OSGeo/gdal/blob/301f31b9b74cd67edcdc555f7e7a58db87cbadb2/frmts/gtiff/gtiff.h#L117-L119