From ce3ce97cdb660e7ba0571c017cc955902d13ae95 Mon Sep 17 00:00:00 2001 From: cody s Date: Tue, 1 Oct 2019 10:35:01 -0600 Subject: [PATCH 1/6] Attempt at getting float32 working. Needs testing --- src/geotiffwriter.js | 6 ++++-- test/index.html | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/geotiffwriter.js b/src/geotiffwriter.js index f043bde7..45821d38 100644 --- a/src/geotiffwriter.js +++ b/src/geotiffwriter.js @@ -250,13 +250,15 @@ const encodeImage = (values, width, height, metadata) => { } } + const DataType = values.constructor + const prfx = new Uint8Array(encodeIfds([ifd])); - const img = new Uint8Array(values); + const img = new Uint8Array(values.buffer); const samplesPerPixel = ifd[277]; - const data = new Uint8Array(numBytesInIfd + (width * height * samplesPerPixel)); + const data = new Uint8Array(numBytesInIfd + (img.length * samplesPerPixel)); times(prfx.length, (i) => { data[i] = prfx[i]; }); forEach(img, (value, i) => { data[numBytesInIfd + i] = value; diff --git a/test/index.html b/test/index.html index 237c8a6e..bb02838e 100644 --- a/test/index.html +++ b/test/index.html @@ -8,7 +8,7 @@ - +