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