@gisatcz/deckgl-geolib 1.6.0-dev.0 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +30 -0
- package/dist/cjs/index.js +12 -16
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/index.min.js +1 -1
- package/dist/cjs/index.min.js.map +1 -1
- package/dist/esm/index.js +12 -16
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/index.min.js +1 -1
- package/dist/esm/index.min.js.map +1 -1
- package/package.json +1 -1
- package/src/cogbitmaplayer/README.md +34 -21
- package/src/cogterrainlayer/README.md +36 -23
- package/src/cogtiles/README.md +4 -4
- package/src/geoimage/README.md +13 -13
- package/src/geoimage/geoimage.ts +13 -19
package/dist/esm/index.js
CHANGED
|
@@ -15019,24 +15019,20 @@ class GeoImage {
|
|
|
15019
15019
|
canvas.height = height;
|
|
15020
15020
|
const c = canvas.getContext('2d');
|
|
15021
15021
|
const imageData = c.createImageData(width, height);
|
|
15022
|
-
const
|
|
15023
|
-
const
|
|
15024
|
-
let pixel = 0;
|
|
15025
|
-
|
|
15026
|
-
|
|
15027
|
-
|
|
15028
|
-
|
|
15029
|
-
|
|
15030
|
-
|
|
15031
|
-
|
|
15032
|
-
imageData.data[i] =
|
|
15033
|
-
imageData.data[i + 1] = Math.trunc(multiplied * 0.00390625) - imageData.data[i] * 256;
|
|
15034
|
-
imageData.data[i + 2] = Math.trunc(multiplied) - imageData.data[i] * 65536
|
|
15035
|
-
- imageData.data[i + 1] * 256;
|
|
15022
|
+
const numOfChannels = channel.length / (width * height);
|
|
15023
|
+
const size = width * height * 4;
|
|
15024
|
+
let pixel = options.useChannel === null ? 0 : options.useChannel;
|
|
15025
|
+
for (let i = 0; i < size; i += 4) {
|
|
15026
|
+
// height image calculation based on:
|
|
15027
|
+
// https://deck.gl/docs/api-reference/geo-layers/terrain-layer
|
|
15028
|
+
const elevationValue = channel[pixel] * options.multiplier;
|
|
15029
|
+
const colorValue = Math.floor((elevationValue + 10000) / 0.1);
|
|
15030
|
+
imageData.data[i] = Math.floor(colorValue / (256 * 256));
|
|
15031
|
+
imageData.data[i + 1] = Math.floor((colorValue / 256) % 256);
|
|
15032
|
+
imageData.data[i + 2] = colorValue % 256;
|
|
15036
15033
|
imageData.data[i + 3] = 255;
|
|
15037
|
-
pixel +=
|
|
15034
|
+
pixel += numOfChannels;
|
|
15038
15035
|
}
|
|
15039
|
-
// console.timeEnd("heightmap generated in");
|
|
15040
15036
|
c.putImageData(imageData, 0, 0);
|
|
15041
15037
|
const imageUrl = canvas.toDataURL('image/png');
|
|
15042
15038
|
// console.log('Heightmap generated.');
|