@gisatcz/deckgl-geolib 2.4.0-dev.4 → 2.4.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/dist/cjs/index.js +18 -14
- 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 +18 -14
- 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/core/CogTiles.d.ts +4 -4
- package/dist/esm/types/core/GeoImage.d.ts +2 -2
- package/dist/esm/types/core/lib/TerrainGenerator.d.ts +2 -2
- package/dist/esm/types/layers/CogBitmapLayer.d.ts +3 -3
- package/dist/esm/types/layers/CogTerrainLayer.d.ts +2 -2
- package/package.json +16 -16
package/dist/esm/index.js
CHANGED
|
@@ -5330,11 +5330,11 @@ class BitmapGenerator {
|
|
|
5330
5330
|
}
|
|
5331
5331
|
static getColorValue(dataArray, options, arrayLength, samplesPerPixel = 1) {
|
|
5332
5332
|
// Normalize all colorScale entries for chroma.js compatibility
|
|
5333
|
-
const colorScale = chroma.scale(options.colorScale?.map(c => Array.isArray(c) ? chroma(c) : c)).domain(options.colorScaleValueRange);
|
|
5333
|
+
const colorScale = chroma.scale(options.colorScale?.map(c => Array.isArray(c) ? chroma(c) : c)).domain(options.colorScaleValueRange ?? [0, 255]);
|
|
5334
5334
|
const colorsArray = new Uint8ClampedArray(arrayLength);
|
|
5335
|
-
const optAlpha = Math.floor(options.alpha * 2.55);
|
|
5336
|
-
const rangeMin = options.colorScaleValueRange[0];
|
|
5337
|
-
const rangeMax = options.colorScaleValueRange
|
|
5335
|
+
const optAlpha = Math.floor((options.alpha ?? 100) * 2.55);
|
|
5336
|
+
const rangeMin = options.colorScaleValueRange?.[0] ?? 0;
|
|
5337
|
+
const rangeMax = options.colorScaleValueRange?.[1] ?? 255;
|
|
5338
5338
|
const is8Bit = dataArray instanceof Uint8Array || dataArray instanceof Uint8ClampedArray;
|
|
5339
5339
|
const isFloatOrWide = !is8Bit && (dataArray instanceof Float32Array || dataArray instanceof Uint16Array || dataArray instanceof Int16Array);
|
|
5340
5340
|
// 1. 8-BIT COMPREHENSIVE LUT
|
|
@@ -5647,6 +5647,7 @@ class TerrainGenerator {
|
|
|
5647
5647
|
const cellSize = input.cellSizeMeters ?? ((input.bounds[2] - input.bounds[0]) / 256);
|
|
5648
5648
|
const zFactor = options.zFactor ?? 1;
|
|
5649
5649
|
if (options.useSlope && options.useHillshade) {
|
|
5650
|
+
// eslint-disable-next-line no-console
|
|
5650
5651
|
console.warn('[TerrainGenerator] useSlope and useHillshade are mutually exclusive; useSlope takes precedence.');
|
|
5651
5652
|
}
|
|
5652
5653
|
// Build a separate raster for kernel computation that preserves noData samples.
|
|
@@ -5660,7 +5661,6 @@ class TerrainGenerator {
|
|
|
5660
5661
|
for (let i = 0; i < terrain.length; i++) {
|
|
5661
5662
|
// If the source raster marks this sample as noData, keep it as noData for the kernel.
|
|
5662
5663
|
// Otherwise, use the processed terrain elevation value.
|
|
5663
|
-
// eslint-disable-next-line eqeqeq
|
|
5664
5664
|
kernelTerrain[i] = sourceRaster[i] == noData ? noData : terrain[i];
|
|
5665
5665
|
}
|
|
5666
5666
|
}
|
|
@@ -5902,8 +5902,8 @@ class CogTiles {
|
|
|
5902
5902
|
cogResolutionLookup = [];
|
|
5903
5903
|
cogOrigin = [0, 0];
|
|
5904
5904
|
zoomRange = [0, 0];
|
|
5905
|
-
tileSize;
|
|
5906
|
-
bounds
|
|
5905
|
+
tileSize = 256;
|
|
5906
|
+
bounds = [0, 0, 0, 0];
|
|
5907
5907
|
geo = new GeoImage();
|
|
5908
5908
|
options;
|
|
5909
5909
|
constructor(options) {
|
|
@@ -6097,7 +6097,7 @@ class CogTiles {
|
|
|
6097
6097
|
if (missingLeft > 0 || missingTop > 0 || readWidth < FETCH_SIZE || readHeight < FETCH_SIZE) {
|
|
6098
6098
|
const numChannels = this.options.numOfChannels || 1;
|
|
6099
6099
|
// Initialize with a TypedArray of the full target size and correct data type
|
|
6100
|
-
const validImageData = this.createTileBuffer(this.options.format, FETCH_SIZE, numChannels);
|
|
6100
|
+
const validImageData = this.createTileBuffer(this.options.format || 'Float32', FETCH_SIZE, numChannels);
|
|
6101
6101
|
if (this.options.noDataValue !== undefined) {
|
|
6102
6102
|
validImageData.fill(this.options.noDataValue);
|
|
6103
6103
|
}
|
|
@@ -6106,7 +6106,7 @@ class CogTiles {
|
|
|
6106
6106
|
// Place the valid pixel data into the tile buffer.
|
|
6107
6107
|
for (let band = 0; band < validRasterData.length; band += 1) {
|
|
6108
6108
|
// We must reset the buffer for each band, otherwise data from previous band persists in padding areas
|
|
6109
|
-
const tileBuffer = this.createTileBuffer(this.options.format, FETCH_SIZE);
|
|
6109
|
+
const tileBuffer = this.createTileBuffer(this.options.format || 'Float32', FETCH_SIZE);
|
|
6110
6110
|
if (this.options.noDataValue !== undefined) {
|
|
6111
6111
|
tileBuffer.fill(this.options.noDataValue);
|
|
6112
6112
|
}
|
|
@@ -6528,7 +6528,7 @@ class CogTerrainLayer extends CompositeLayer {
|
|
|
6528
6528
|
static defaultProps = defaultProps;
|
|
6529
6529
|
static layerName = 'CogTerrainLayer';
|
|
6530
6530
|
// terrainCogTiles: CogTiles;
|
|
6531
|
-
terrainUrl;
|
|
6531
|
+
terrainUrl = '';
|
|
6532
6532
|
async initializeState(context) {
|
|
6533
6533
|
super.initializeState(context);
|
|
6534
6534
|
this.setState({
|
|
@@ -6650,16 +6650,19 @@ class CogTerrainLayer extends CompositeLayer {
|
|
|
6650
6650
|
const { zRange } = this.state;
|
|
6651
6651
|
const ranges = tiles
|
|
6652
6652
|
.map((tile) => tile.content)
|
|
6653
|
-
.filter((x) => x && x[0])
|
|
6653
|
+
.filter((x) => !!x && !!x[0])
|
|
6654
6654
|
.map((arr) => {
|
|
6655
|
+
if (!arr || !arr[0])
|
|
6656
|
+
return undefined;
|
|
6655
6657
|
const bounds = arr[0]?.map?.header?.boundingBox;
|
|
6656
6658
|
return bounds?.map((bound) => bound[2]);
|
|
6657
|
-
})
|
|
6659
|
+
})
|
|
6660
|
+
.filter((x) => x !== undefined);
|
|
6658
6661
|
if (ranges.length === 0) {
|
|
6659
6662
|
return;
|
|
6660
6663
|
}
|
|
6661
|
-
const minZ = Math.min(...ranges.map((x) => x[0]));
|
|
6662
|
-
const maxZ = Math.max(...ranges.map((x) => x[1]));
|
|
6664
|
+
const minZ = Math.min(...ranges.map((x) => x?.[0] ?? 0).filter((n) => Number.isFinite(n)));
|
|
6665
|
+
const maxZ = Math.max(...ranges.map((x) => x?.[1] ?? 0).filter((n) => Number.isFinite(n)));
|
|
6663
6666
|
if (!zRange || minZ < zRange[0] || maxZ > zRange[1]) {
|
|
6664
6667
|
this.setState({ zRange: [Number.isFinite(minZ) ? minZ : 0, Number.isFinite(maxZ) ? maxZ : 0] });
|
|
6665
6668
|
}
|
|
@@ -6706,6 +6709,7 @@ class CogTerrainLayer extends CompositeLayer {
|
|
|
6706
6709
|
refinementStrategy,
|
|
6707
6710
|
});
|
|
6708
6711
|
}
|
|
6712
|
+
return null;
|
|
6709
6713
|
}
|
|
6710
6714
|
}
|
|
6711
6715
|
|