@gisatcz/deckgl-geolib 1.4.2 → 1.4.3-dev.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 +0 -12
- package/dist/cjs/index.js +13 -5
- 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/cjs/types/geoimage/geoimage.d.ts +1 -0
- package/dist/esm/index.js +13 -5
- 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/dist/esm/types/geoimage/geoimage.d.ts +1 -0
- package/package.json +1 -1
- package/src/cogterrainlayer/CogTerrainLayer.ts +2 -0
- package/src/geoimage/geoimage.ts +13 -5
|
@@ -46,4 +46,5 @@ export default class GeoImage {
|
|
|
46
46
|
getColorValue(dataArray: [], options: GeoImageOptions, arrayLength: number, numOfChannels?: number): any[];
|
|
47
47
|
getDefaultColor(size: any, nullColor: any): any[];
|
|
48
48
|
getColorFromChromaType(colorDefinition: any): any[];
|
|
49
|
+
hasPixelsNoData(pixels: any, noDataValue: any): any;
|
|
49
50
|
}
|
package/package.json
CHANGED
package/src/geoimage/geoimage.ts
CHANGED
|
@@ -231,14 +231,18 @@ export default class GeoImage {
|
|
|
231
231
|
imageData.data[index] = value;
|
|
232
232
|
});
|
|
233
233
|
}
|
|
234
|
+
// RGB values in one channel
|
|
234
235
|
if (rasters[0].length / (width * height) === 3) {
|
|
235
236
|
// console.log("geoImage: " + "RGB 1 array of length: " + rasters[0].length);
|
|
236
237
|
let pixel = 0;
|
|
237
|
-
for (let
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
238
|
+
for (let idx = 0; idx < size; idx += 4) {
|
|
239
|
+
const rgbColor = [rasters[0][pixel], rasters[0][pixel + 1], rasters[0][pixel + 2]];
|
|
240
|
+
const rgbaColor = this.hasPixelsNoData(rgbColor, optionsLocal.noDataValue)
|
|
241
|
+
? optionsLocal.nullColor
|
|
242
|
+
: [...rgbColor, optionsLocal.alpha!];
|
|
243
|
+
// eslint-disable-next-line max-len
|
|
244
|
+
[imageData.data[idx], imageData.data[idx + 1], imageData.data[idx + 2], imageData.data[idx + 3]] = rgbaColor;
|
|
245
|
+
pixel += 3;
|
|
242
246
|
}
|
|
243
247
|
}
|
|
244
248
|
if (rasters[0].length / (width * height) === 4) {
|
|
@@ -387,4 +391,8 @@ export default class GeoImage {
|
|
|
387
391
|
}
|
|
388
392
|
return colorDefinition;
|
|
389
393
|
}
|
|
394
|
+
|
|
395
|
+
hasPixelsNoData(pixels, noDataValue) {
|
|
396
|
+
return noDataValue !== undefined && pixels.every((pixel) => pixel === noDataValue);
|
|
397
|
+
}
|
|
390
398
|
}
|