@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 CHANGED
@@ -1,3 +1,33 @@
1
+ # v1.7.0 (Wed Jul 26 2023)
2
+
3
+ #### 🚀 Enhancement
4
+
5
+ - height images calculation updated [#33](https://github.com/gisat-panther/deck.gl-geotiff/pull/33) (mariana.kecova@gisat.cz [@MariDani](https://github.com/MariDani))
6
+
7
+ #### 📝 Documentation
8
+
9
+ - Documentation [#29](https://github.com/gisat-panther/deck.gl-geotiff/pull/29) (mariana.kecova@gisat.cz [@MariDani](https://github.com/MariDani))
10
+
11
+ #### Authors: 2
12
+
13
+ - Mariana Kecová ([@MariDani](https://github.com/MariDani))
14
+ - Mariana Kecova (mariana.kecova@gisat.cz)
15
+
16
+ ---
17
+
18
+ # v1.6.0 (Mon Jun 26 2023)
19
+
20
+ #### 🚀 Enhancement
21
+
22
+ - Feature/terrain layer [#27](https://github.com/gisat-panther/deck.gl-geotiff/pull/27) ([@vdubr](https://github.com/vdubr) ci@example.com)
23
+
24
+ #### Authors: 2
25
+
26
+ - ci (ci@example.com)
27
+ - Vojtěch Dubrovský ([@vdubr](https://github.com/vdubr))
28
+
29
+ ---
30
+
1
31
  # v1.5.0 (Fri Jun 23 2023)
2
32
 
3
33
  #### 🚀 Enhancement
package/dist/cjs/index.js CHANGED
@@ -15021,24 +15021,20 @@ class GeoImage {
15021
15021
  canvas.height = height;
15022
15022
  const c = canvas.getContext('2d');
15023
15023
  const imageData = c.createImageData(width, height);
15024
- const channelCount = channel.length / (width * height);
15025
- const s = width * height * 4;
15026
- let pixel = 0;
15027
- if (options.useChannel != null) {
15028
- pixel = options.useChannel;
15029
- }
15030
- // console.time("heightmap generated in");
15031
- for (let i = 0; i < s; i += 4) {
15032
- channel[pixel] *= options.multiplier;
15033
- const multiplied = 100000 + channel[pixel] * 10;
15034
- imageData.data[i] = Math.trunc(multiplied * 0.00001525878);
15035
- imageData.data[i + 1] = Math.trunc(multiplied * 0.00390625) - imageData.data[i] * 256;
15036
- imageData.data[i + 2] = Math.trunc(multiplied) - imageData.data[i] * 65536
15037
- - imageData.data[i + 1] * 256;
15024
+ const numOfChannels = channel.length / (width * height);
15025
+ const size = width * height * 4;
15026
+ let pixel = options.useChannel === null ? 0 : options.useChannel;
15027
+ for (let i = 0; i < size; i += 4) {
15028
+ // height image calculation based on:
15029
+ // https://deck.gl/docs/api-reference/geo-layers/terrain-layer
15030
+ const elevationValue = channel[pixel] * options.multiplier;
15031
+ const colorValue = Math.floor((elevationValue + 10000) / 0.1);
15032
+ imageData.data[i] = Math.floor(colorValue / (256 * 256));
15033
+ imageData.data[i + 1] = Math.floor((colorValue / 256) % 256);
15034
+ imageData.data[i + 2] = colorValue % 256;
15038
15035
  imageData.data[i + 3] = 255;
15039
- pixel += channelCount;
15036
+ pixel += numOfChannels;
15040
15037
  }
15041
- // console.timeEnd("heightmap generated in");
15042
15038
  c.putImageData(imageData, 0, 0);
15043
15039
  const imageUrl = canvas.toDataURL('image/png');
15044
15040
  // console.log('Heightmap generated.');