GeoTIFF / georaster

Wrapper around Georeferenced Rasters like GeoTIFF and soon JPG and PNG that provides a standard interface
Apache License 2.0
81 stars 32 forks source link

Error Parsing deflate compressed geotiffs #48

Closed miccoh1994 closed 4 years ago

miccoh1994 commented 4 years ago

Describe the bug When attempting to load a deflate compressed tiff in geoblaze the following error is thrown:

Error: Geoblaze had a problem parsing this file. Please make sure that you are sending a proper GeoTIFF file and try again.

This was traced back to geoblaze dependency georaster:

When attempting to parse a geotiff with compression type deflate (32946) georaster throws the error:

Error: Unknown compression method identifier: 32946 at t.getDecoder (node_modules\georaster\dist\georaster.bundle.min.js:1:346511)

To Reproduce

Server side: npm install georaster

run following code in any file

async function testGeoraster() {
    fs.readFile("./data/deflate.tiff", (error, data) => {
        parseGeoraster(data).then(georaster => {
            console.log('georaster: ',georaster)
        })
    }
    )
}

testGeoraster()

Expected behavior Expected output is an object representing the data as an array buffer.

Desktop (please complete the following information): Affects loading this type of tiff in node and browser

Additional context you can download the same raster here and try load it at geotiff.io

A workaround to the issue was to fork georaster and geoblaze and generate new builds. However this is not optimal.

Can georaster please run a new build and release it on npm.

DanielJDufour commented 4 years ago

Thank you for submitting this. I'll fix this as soon as I can.

DanielJDufour commented 4 years ago

Hi, @miccoh1994 . I think I fixed this. Could you try the new version of georaster and let me know if this worked. Here's sample code for your convenience:

const parseGeoRaster = require("georaster");
const { readFileSync } = require("fs");

const arrayBuffer = readFileSync("1.tiff").buffer;
...
const georaster = parseGeoRaster(arrayBuffer);
miccoh1994 commented 4 years ago

Thanks Daniel, it's working now :)