@gisatcz/deckgl-geolib 2.4.1-dev.1 → 2.5.0-dev.1
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/README.md +1 -0
- package/dist/cjs/index.js +421 -54
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/index.min.js +2 -2
- package/dist/cjs/index.min.js.map +1 -1
- package/dist/esm/index.js +421 -54
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/index.min.js +2 -2
- package/dist/esm/index.min.js.map +1 -1
- package/dist/esm/types/core/CogTiles.d.ts +2 -2
- package/dist/esm/types/core/GeoImage.d.ts +2 -0
- package/dist/esm/types/core/lib/BitmapGenerator.d.ts +21 -1
- package/dist/esm/types/core/lib/KernelGenerator.d.ts +12 -0
- package/dist/esm/types/core/lib/ReliefCompositor.d.ts +28 -0
- package/dist/esm/types/core/lib/TerrainGenerator.d.ts +6 -1
- package/dist/esm/types/core/types.d.ts +9 -0
- package/package.json +1 -1
package/dist/esm/index.js
CHANGED
|
@@ -4893,9 +4893,23 @@ const DefaultGeoImageOptions = {
|
|
|
4893
4893
|
color: [255, 0, 255, 255],
|
|
4894
4894
|
colorScale: chroma.brewer.YlOrRd,
|
|
4895
4895
|
colorScaleValueRange: [0, 255],
|
|
4896
|
+
// colorScale: [
|
|
4897
|
+
// [75, 120, 90], // Brightened forest green
|
|
4898
|
+
// [100, 145, 100], // Soft meadow green
|
|
4899
|
+
// [130, 170, 110], // Bright moss
|
|
4900
|
+
// [185, 210, 145], // Sunny sage
|
|
4901
|
+
// [235, 235, 185], // Pale primrose (transitional)
|
|
4902
|
+
// [225, 195, 160], // Sand / light terracotta (matches slope)
|
|
4903
|
+
// [195, 160, 130], // Warm clay brown
|
|
4904
|
+
// [170, 155, 150], // Warm slate grey
|
|
4905
|
+
// [245, 245, 240], // Bright mist
|
|
4906
|
+
// [255, 255, 255], // Pure peak white
|
|
4907
|
+
// ],
|
|
4908
|
+
// colorScaleValueRange: [0, 6500],
|
|
4896
4909
|
colorsBasedOnValues: undefined,
|
|
4897
4910
|
colorClasses: undefined,
|
|
4898
4911
|
alpha: 100,
|
|
4912
|
+
maxGlazeAlpha: 128,
|
|
4899
4913
|
nullColor: [0, 0, 0, 0],
|
|
4900
4914
|
unidentifiedColor: [0, 0, 0, 0],
|
|
4901
4915
|
clippedColor: [0, 0, 0, 0],
|
|
@@ -4905,6 +4919,11 @@ const DefaultGeoImageOptions = {
|
|
|
4905
4919
|
hillshadeAzimuth: 315,
|
|
4906
4920
|
hillshadeAltitude: 45,
|
|
4907
4921
|
zFactor: 1,
|
|
4922
|
+
useSwissRelief: false,
|
|
4923
|
+
swissSlopeWeight: 0.5,
|
|
4924
|
+
useReliefGlaze: false,
|
|
4925
|
+
// --- Lighting control ---
|
|
4926
|
+
disableLighting: false,
|
|
4908
4927
|
};
|
|
4909
4928
|
|
|
4910
4929
|
class Martini {
|
|
@@ -5591,6 +5610,11 @@ function scale(num, inMin, inMax, outMin, outMax) {
|
|
|
5591
5610
|
}
|
|
5592
5611
|
|
|
5593
5612
|
class BitmapGenerator {
|
|
5613
|
+
/**
|
|
5614
|
+
* Cache for Swiss relief color LUTs to avoid regenerating on every tile.
|
|
5615
|
+
* Key: colorScale config + range, Value: pre-computed RGBA LUT
|
|
5616
|
+
*/
|
|
5617
|
+
static _swissColorLUTCache = new Map();
|
|
5594
5618
|
/**
|
|
5595
5619
|
* Main entry point: Generates an ImageBitmap from raw raster data.
|
|
5596
5620
|
*/
|
|
@@ -5617,7 +5641,31 @@ class BitmapGenerator {
|
|
|
5617
5641
|
// If planar support is added, this logic must be updated to handle both layouts correctly.
|
|
5618
5642
|
const numAvailableChannels = optionsLocal.numOfChannels ??
|
|
5619
5643
|
(rasters.length === 1 ? rasters[0].length / (width * height) : rasters.length);
|
|
5620
|
-
if (optionsLocal.
|
|
5644
|
+
if (optionsLocal.useReliefGlaze) {
|
|
5645
|
+
if (rasters.length >= 1) {
|
|
5646
|
+
// Relief glaze: pure black/white overlay with variable alpha
|
|
5647
|
+
imageData.data.set(this.getReliefGlazeRGBA(rasters, optionsLocal, size));
|
|
5648
|
+
}
|
|
5649
|
+
else {
|
|
5650
|
+
// Missing relief mask: fill with transparent
|
|
5651
|
+
const transparentData = new Uint8ClampedArray(size);
|
|
5652
|
+
transparentData.fill(0);
|
|
5653
|
+
imageData.data.set(transparentData);
|
|
5654
|
+
}
|
|
5655
|
+
}
|
|
5656
|
+
else if (optionsLocal.useSwissRelief) {
|
|
5657
|
+
if (rasters.length === 2) {
|
|
5658
|
+
// Normal Swiss relief rendering: hypsometric color × relief mask
|
|
5659
|
+
imageData.data.set(this.getColorValue(rasters, optionsLocal, size));
|
|
5660
|
+
}
|
|
5661
|
+
else { // Missing mask: fill with null color (fully transparent or a fallback)
|
|
5662
|
+
const defaultColorData = this.getDefaultColor(size, optionsLocal.nullColor);
|
|
5663
|
+
defaultColorData.forEach((value, index) => {
|
|
5664
|
+
imageData.data[index] = value;
|
|
5665
|
+
});
|
|
5666
|
+
}
|
|
5667
|
+
}
|
|
5668
|
+
else if (optionsLocal.useChannelIndex == null) {
|
|
5621
5669
|
if (isInterleaved) {
|
|
5622
5670
|
const ratio = rasters[0].length / (width * height);
|
|
5623
5671
|
if (ratio === 1) {
|
|
@@ -5685,9 +5733,68 @@ class BitmapGenerator {
|
|
|
5685
5733
|
const optAlpha = Math.floor((options.alpha ?? 100) * 2.55);
|
|
5686
5734
|
const rangeMin = options.colorScaleValueRange?.[0] ?? 0;
|
|
5687
5735
|
const rangeMax = options.colorScaleValueRange?.[1] ?? 255;
|
|
5688
|
-
const
|
|
5689
|
-
const
|
|
5690
|
-
|
|
5736
|
+
const isMultiRaster = Array.isArray(dataArray);
|
|
5737
|
+
const primaryBuffer = isMultiRaster ? dataArray[0] : dataArray;
|
|
5738
|
+
const isSwiss = options.useSwissRelief && isMultiRaster && dataArray.length >= 2;
|
|
5739
|
+
const is8Bit = primaryBuffer instanceof Uint8Array || primaryBuffer instanceof Uint8ClampedArray;
|
|
5740
|
+
const isFloatOrWide = !is8Bit && (primaryBuffer instanceof Float32Array || primaryBuffer instanceof Uint16Array || primaryBuffer instanceof Int16Array);
|
|
5741
|
+
// 1. SWISS MODE BRANCH
|
|
5742
|
+
if (isSwiss) {
|
|
5743
|
+
const reliefMask = dataArray[1];
|
|
5744
|
+
const rangeSpan = (rangeMax - rangeMin) || 1;
|
|
5745
|
+
// Only use LUT optimization for useHeatMap mode; other modes use calculateSingleColor per-pixel
|
|
5746
|
+
let lut = null;
|
|
5747
|
+
if (options.useHeatMap) {
|
|
5748
|
+
const LUT_SIZE = 1024;
|
|
5749
|
+
// Cache LUT: generate key from colorScale config + range + alpha
|
|
5750
|
+
const cacheKey = `${rangeMin}_${rangeMax}_${optAlpha}_${JSON.stringify(options.colorScale)}`;
|
|
5751
|
+
lut = this._swissColorLUTCache.get(cacheKey) || null;
|
|
5752
|
+
if (!lut) {
|
|
5753
|
+
// LUT not cached, generate it
|
|
5754
|
+
lut = new Uint8ClampedArray(LUT_SIZE * 4);
|
|
5755
|
+
for (let i = 0; i < LUT_SIZE; i++) {
|
|
5756
|
+
const domainVal = rangeMin + (i / (LUT_SIZE - 1)) * rangeSpan;
|
|
5757
|
+
const rgb = colorScale(domainVal).rgb();
|
|
5758
|
+
lut[i * 4] = rgb[0];
|
|
5759
|
+
lut[i * 4 + 1] = rgb[1];
|
|
5760
|
+
lut[i * 4 + 2] = rgb[2];
|
|
5761
|
+
lut[i * 4 + 3] = optAlpha;
|
|
5762
|
+
}
|
|
5763
|
+
this._swissColorLUTCache.set(cacheKey, lut);
|
|
5764
|
+
}
|
|
5765
|
+
}
|
|
5766
|
+
for (let i = 0, sampleIndex = (options.useChannelIndex ?? 0); i < arrayLength; i += 4, sampleIndex += samplesPerPixel) {
|
|
5767
|
+
const elevationVal = primaryBuffer[sampleIndex];
|
|
5768
|
+
// NaN-aware noData check for Swiss relief
|
|
5769
|
+
const isNoData = options.noDataValue !== undefined && (Number.isNaN(options.noDataValue)
|
|
5770
|
+
? Number.isNaN(elevationVal)
|
|
5771
|
+
: elevationVal === options.noDataValue);
|
|
5772
|
+
if (Number.isNaN(elevationVal) || isNoData) {
|
|
5773
|
+
colorsArray.set(options.nullColor, i);
|
|
5774
|
+
continue;
|
|
5775
|
+
}
|
|
5776
|
+
let baseColor;
|
|
5777
|
+
if (lut) {
|
|
5778
|
+
// LUT-optimized path for useHeatMap
|
|
5779
|
+
const t = (elevationVal - rangeMin) / rangeSpan;
|
|
5780
|
+
const lutIdx = Math.min(1023, Math.max(0, Math.floor(t * 1023))) * 4;
|
|
5781
|
+
baseColor = [lut[lutIdx], lut[lutIdx + 1], lut[lutIdx + 2], lut[lutIdx + 3]];
|
|
5782
|
+
}
|
|
5783
|
+
else {
|
|
5784
|
+
// Per-pixel calculation for useSingleColor, useColorClasses, useColorsBasedOnValues
|
|
5785
|
+
baseColor = this.calculateSingleColor(elevationVal, colorScale, options, optAlpha);
|
|
5786
|
+
}
|
|
5787
|
+
// Apply relief mask as multiplier (Ambient Fill approach)
|
|
5788
|
+
const maskVal = reliefMask[sampleIndex];
|
|
5789
|
+
const multiplier = 0.4 + 0.6 * (maskVal / 255);
|
|
5790
|
+
colorsArray[i] = Math.floor(baseColor[0] * multiplier);
|
|
5791
|
+
colorsArray[i + 1] = Math.floor(baseColor[1] * multiplier);
|
|
5792
|
+
colorsArray[i + 2] = Math.floor(baseColor[2] * multiplier);
|
|
5793
|
+
colorsArray[i + 3] = baseColor[3];
|
|
5794
|
+
}
|
|
5795
|
+
return colorsArray;
|
|
5796
|
+
}
|
|
5797
|
+
// 2. 8-BIT COMPREHENSIVE LUT
|
|
5691
5798
|
// Single-band 8-bit (grayscale or indexed): use LUT for fast mapping
|
|
5692
5799
|
if (is8Bit && !options.useDataForOpacity) {
|
|
5693
5800
|
const lut = new Uint8ClampedArray(256 * 4);
|
|
@@ -5701,7 +5808,7 @@ class BitmapGenerator {
|
|
|
5701
5808
|
}
|
|
5702
5809
|
}
|
|
5703
5810
|
for (let i = 0, sampleIndex = (options.useChannelIndex ?? 0); i < arrayLength; i += 4, sampleIndex += samplesPerPixel) {
|
|
5704
|
-
const lutIdx =
|
|
5811
|
+
const lutIdx = primaryBuffer[sampleIndex] * 4;
|
|
5705
5812
|
colorsArray[i] = lut[lutIdx];
|
|
5706
5813
|
colorsArray[i + 1] = lut[lutIdx + 1];
|
|
5707
5814
|
colorsArray[i + 2] = lut[lutIdx + 2];
|
|
@@ -5709,7 +5816,7 @@ class BitmapGenerator {
|
|
|
5709
5816
|
}
|
|
5710
5817
|
return colorsArray;
|
|
5711
5818
|
}
|
|
5712
|
-
//
|
|
5819
|
+
// 3. FLOAT / 16-BIT LUT (HEATMAP ONLY)
|
|
5713
5820
|
if (isFloatOrWide && options.useHeatMap && !options.useDataForOpacity) {
|
|
5714
5821
|
const LUT_SIZE = 1024;
|
|
5715
5822
|
const lut = new Uint8ClampedArray(LUT_SIZE * 4);
|
|
@@ -5729,7 +5836,7 @@ class BitmapGenerator {
|
|
|
5729
5836
|
}
|
|
5730
5837
|
}
|
|
5731
5838
|
for (let i = 0, sampleIndex = (options.useChannelIndex ?? 0); i < arrayLength; i += 4, sampleIndex += samplesPerPixel) {
|
|
5732
|
-
const val =
|
|
5839
|
+
const val = primaryBuffer[sampleIndex];
|
|
5733
5840
|
if (this.isInvalid(val, options)) {
|
|
5734
5841
|
colorsArray.set(this.getInvalidColor(val, options), i);
|
|
5735
5842
|
}
|
|
@@ -5744,10 +5851,10 @@ class BitmapGenerator {
|
|
|
5744
5851
|
}
|
|
5745
5852
|
return colorsArray;
|
|
5746
5853
|
}
|
|
5747
|
-
//
|
|
5854
|
+
// 4. FALLBACK LOOP (Categorical Float, Opacity, or Single Color)
|
|
5748
5855
|
let sampleIndex = options.useChannelIndex ?? 0;
|
|
5749
5856
|
for (let i = 0; i < arrayLength; i += 4) {
|
|
5750
|
-
const val =
|
|
5857
|
+
const val = primaryBuffer[sampleIndex];
|
|
5751
5858
|
let color;
|
|
5752
5859
|
if ((options.clipLow != null && val <= options.clipLow) || (options.clipHigh != null && val >= options.clipHigh)) {
|
|
5753
5860
|
color = options.clippedColor;
|
|
@@ -5763,6 +5870,50 @@ class BitmapGenerator {
|
|
|
5763
5870
|
}
|
|
5764
5871
|
return colorsArray;
|
|
5765
5872
|
}
|
|
5873
|
+
/**
|
|
5874
|
+
* Generate relief glaze RGBA output.
|
|
5875
|
+
* Maps relief mask (0-255) to pure black/white glaze with variable alpha.
|
|
5876
|
+
* - reliefValue < 128: Pure black (0,0,0) darkens shadows
|
|
5877
|
+
* - reliefValue > 128: Pure white (255,255,255) brightens highlights
|
|
5878
|
+
* - reliefValue == 128: Transparent (no effect)
|
|
5879
|
+
*
|
|
5880
|
+
* High-performance implementation using pre-computed alpha LUT to avoid 65k Math.pow calls.
|
|
5881
|
+
*
|
|
5882
|
+
* @param rasters Array of [relief mask raster] (single raster expected)
|
|
5883
|
+
* @param options GeoImageOptions (alpha used for opacity scaling)
|
|
5884
|
+
* @param arrayLength Total RGBA array length
|
|
5885
|
+
* @returns Uint8ClampedArray of RGBA values
|
|
5886
|
+
*/
|
|
5887
|
+
static getReliefGlazeRGBA(rasters, options, arrayLength) {
|
|
5888
|
+
const reliefMask = rasters[0];
|
|
5889
|
+
const opacityFactor = (options.maxGlazeAlpha ?? 128) / 255;
|
|
5890
|
+
// Pre-compute alpha lookup table (256 entries, one per relief value 0-255)
|
|
5891
|
+
const alphaLookup = new Uint8Array(256);
|
|
5892
|
+
for (let v = 0; v < 256; v++) {
|
|
5893
|
+
if (v === 0) {
|
|
5894
|
+
alphaLookup[v] = 0; // noData: fully transparent
|
|
5895
|
+
}
|
|
5896
|
+
else {
|
|
5897
|
+
const alphaDist = Math.abs(v - 128) / 128;
|
|
5898
|
+
const bias = v < 128 ? 0.6 : 0.8;
|
|
5899
|
+
alphaLookup[v] = Math.floor(Math.pow(alphaDist, bias) * 255 * opacityFactor);
|
|
5900
|
+
}
|
|
5901
|
+
}
|
|
5902
|
+
const glazeArray = new Uint8ClampedArray(arrayLength);
|
|
5903
|
+
let maskIndex = 0;
|
|
5904
|
+
for (let i = 0; i < arrayLength; i += 4) {
|
|
5905
|
+
const reliefValue = reliefMask[maskIndex];
|
|
5906
|
+
// Pure black for shadows, pure white for highlights (no muddy grays)
|
|
5907
|
+
const glaze = reliefValue < 128 ? 0 : 255;
|
|
5908
|
+
const alpha = alphaLookup[reliefValue];
|
|
5909
|
+
glazeArray[i] = glaze; // R
|
|
5910
|
+
glazeArray[i + 1] = glaze; // G
|
|
5911
|
+
glazeArray[i + 2] = glaze; // B
|
|
5912
|
+
glazeArray[i + 3] = alpha; // A
|
|
5913
|
+
maskIndex++;
|
|
5914
|
+
}
|
|
5915
|
+
return glazeArray;
|
|
5916
|
+
}
|
|
5766
5917
|
static calculateSingleColor(val, colorScale, options, alpha) {
|
|
5767
5918
|
if (this.isInvalid(val, options)) {
|
|
5768
5919
|
return options.nullColor;
|
|
@@ -5843,6 +5994,21 @@ class BitmapGenerator {
|
|
|
5843
5994
|
* Output: Float32Array of 256×256 computed values.
|
|
5844
5995
|
*/
|
|
5845
5996
|
class KernelGenerator {
|
|
5997
|
+
/**
|
|
5998
|
+
* Compute terrain gradients (dzdx, dzdy) using Horn's method.
|
|
5999
|
+
* @param z1-z9 - 3×3 neighborhood elevation values (z5 is center)
|
|
6000
|
+
* @param cellSizeFactor - Pre-computed 1 / (8 * cellSize)
|
|
6001
|
+
* @param geographicConvention - If true, use north-minus-south for dzdy (hillshade). If false, use south-minus-north (slope).
|
|
6002
|
+
*/
|
|
6003
|
+
static computeGradients(z1, z2, z3, z4, /* z5 not needed */ z6, z7, z8, z9, cellSizeFactor, geographicConvention = true) {
|
|
6004
|
+
const dzdx = ((z3 + 2 * z6 + z9) - (z1 + 2 * z4 + z7)) * cellSizeFactor;
|
|
6005
|
+
// Geographic convention (hillshade): north minus south (top rows minus bottom rows)
|
|
6006
|
+
// Slope convention: south minus north (reversed)
|
|
6007
|
+
const dzdy = geographicConvention
|
|
6008
|
+
? ((z1 + 2 * z2 + z3) - (z7 + 2 * z8 + z9)) * cellSizeFactor
|
|
6009
|
+
: ((z7 + 2 * z8 + z9) - (z1 + 2 * z2 + z3)) * cellSizeFactor;
|
|
6010
|
+
return { dzdx, dzdy };
|
|
6011
|
+
}
|
|
5846
6012
|
/**
|
|
5847
6013
|
* Calculates slope (0–90 degrees) for each pixel using Horn's method.
|
|
5848
6014
|
*
|
|
@@ -5855,12 +6021,18 @@ class KernelGenerator {
|
|
|
5855
6021
|
const OUT = 256;
|
|
5856
6022
|
const IN = 258;
|
|
5857
6023
|
const out = new Float32Array(OUT * OUT);
|
|
6024
|
+
// Hoist division out of loop: multiplication is ~2-3x faster than division
|
|
6025
|
+
const cellSizeFactor = 1 / (8 * cellSize);
|
|
6026
|
+
// Cache constant for radians to degrees conversion
|
|
6027
|
+
const RAD_TO_DEG = 180 / Math.PI;
|
|
6028
|
+
const isNaNNoData = noDataValue !== undefined && Number.isNaN(noDataValue);
|
|
5858
6029
|
for (let r = 0; r < OUT; r++) {
|
|
5859
6030
|
for (let c = 0; c < OUT; c++) {
|
|
5860
6031
|
// 3×3 neighborhood in the 258×258 input, centered at (r+1, c+1)
|
|
5861
6032
|
const base = r * IN + c;
|
|
5862
6033
|
const z5 = src[base + IN + 1]; // center pixel
|
|
5863
|
-
|
|
6034
|
+
const isNoData = noDataValue !== undefined && (isNaNNoData ? Number.isNaN(z5) : z5 === noDataValue);
|
|
6035
|
+
if (isNoData) {
|
|
5864
6036
|
out[r * OUT + c] = NaN;
|
|
5865
6037
|
continue;
|
|
5866
6038
|
}
|
|
@@ -5872,10 +6044,9 @@ class KernelGenerator {
|
|
|
5872
6044
|
const z7 = src[base + 2 * IN]; // sw
|
|
5873
6045
|
const z8 = src[base + 2 * IN + 1]; // s
|
|
5874
6046
|
const z9 = src[base + 2 * IN + 2]; // se
|
|
5875
|
-
const dzdx
|
|
5876
|
-
const dzdy = ((z7 + 2 * z8 + z9) - (z1 + 2 * z2 + z3)) / (8 * cellSize);
|
|
6047
|
+
const { dzdx, dzdy } = this.computeGradients(z1, z2, z3, z4, z6, z7, z8, z9, cellSizeFactor, false);
|
|
5877
6048
|
const slopeRad = Math.atan(zFactor * Math.sqrt(dzdx * dzdx + dzdy * dzdy));
|
|
5878
|
-
out[r * OUT + c] = slopeRad *
|
|
6049
|
+
out[r * OUT + c] = slopeRad * RAD_TO_DEG;
|
|
5879
6050
|
}
|
|
5880
6051
|
}
|
|
5881
6052
|
return out;
|
|
@@ -5900,11 +6071,15 @@ class KernelGenerator {
|
|
|
5900
6071
|
if (azimuthMath >= 360)
|
|
5901
6072
|
azimuthMath -= 360;
|
|
5902
6073
|
const azimuthRad = azimuthMath * (Math.PI / 180);
|
|
6074
|
+
// Hoist division out of loop: multiplication is ~2-3x faster than division
|
|
6075
|
+
const cellSizeFactor = 1 / (8 * cellSize);
|
|
6076
|
+
const isNaNNoData = noDataValue !== undefined && Number.isNaN(noDataValue);
|
|
5903
6077
|
for (let r = 0; r < OUT; r++) {
|
|
5904
6078
|
for (let c = 0; c < OUT; c++) {
|
|
5905
6079
|
const base = r * IN + c;
|
|
5906
6080
|
const z5 = src[base + IN + 1]; // center pixel
|
|
5907
|
-
|
|
6081
|
+
const isNoData = noDataValue !== undefined && (isNaNNoData ? Number.isNaN(z5) : z5 === noDataValue);
|
|
6082
|
+
if (isNoData) {
|
|
5908
6083
|
out[r * OUT + c] = NaN;
|
|
5909
6084
|
continue;
|
|
5910
6085
|
}
|
|
@@ -5916,9 +6091,7 @@ class KernelGenerator {
|
|
|
5916
6091
|
const z7 = src[base + 2 * IN]; // sw
|
|
5917
6092
|
const z8 = src[base + 2 * IN + 1]; // s
|
|
5918
6093
|
const z9 = src[base + 2 * IN + 2]; // se
|
|
5919
|
-
const dzdx
|
|
5920
|
-
// dzdy: north minus south (geographic convention — top rows minus bottom rows in raster)
|
|
5921
|
-
const dzdy = ((z1 + 2 * z2 + z3) - (z7 + 2 * z8 + z9)) / (8 * cellSize);
|
|
6094
|
+
const { dzdx, dzdy } = this.computeGradients(z1, z2, z3, z4, z6, z7, z8, z9, cellSizeFactor, true);
|
|
5922
6095
|
const slopeRad = Math.atan(zFactor * Math.sqrt(dzdx * dzdx + dzdy * dzdy));
|
|
5923
6096
|
const aspectRad = Math.atan2(dzdy, -dzdx);
|
|
5924
6097
|
const hillshade = 255 * (Math.cos(zenithRad) * Math.cos(slopeRad) +
|
|
@@ -5928,6 +6101,139 @@ class KernelGenerator {
|
|
|
5928
6101
|
}
|
|
5929
6102
|
return out;
|
|
5930
6103
|
}
|
|
6104
|
+
/**
|
|
6105
|
+
* Calculates a weighted multi-directional hillshade (0–255).
|
|
6106
|
+
* Combines three light sources to reveal structure in shadows.
|
|
6107
|
+
*/
|
|
6108
|
+
static calculateMultiHillshade(src, cellSize, zFactor = 1, noDataValue) {
|
|
6109
|
+
const OUT = 256;
|
|
6110
|
+
const IN = 258;
|
|
6111
|
+
const out = new Float32Array(OUT * OUT);
|
|
6112
|
+
// Hoist division out of loop: multiplication is ~2-3x faster than division
|
|
6113
|
+
const cellSizeFactor = 1 / (8 * cellSize);
|
|
6114
|
+
const isNaNNoData = noDataValue !== undefined && Number.isNaN(noDataValue);
|
|
6115
|
+
// Setup 3 light sources: NW (Main), W (Fill), N (Fill)
|
|
6116
|
+
const lights = [
|
|
6117
|
+
{ az: 315, alt: 45, weight: 0.60 }, // Primary NW
|
|
6118
|
+
{ az: 225, alt: 35, weight: 0.25 }, // Secondary West/SW
|
|
6119
|
+
{ az: 0, alt: 35, weight: 0.15 } // Secondary North
|
|
6120
|
+
].map(l => {
|
|
6121
|
+
const zenithRad = (90 - l.alt) * (Math.PI / 180);
|
|
6122
|
+
let azMath = 360 - l.az + 90;
|
|
6123
|
+
if (azMath >= 360)
|
|
6124
|
+
azMath -= 360;
|
|
6125
|
+
return {
|
|
6126
|
+
zCos: Math.cos(zenithRad),
|
|
6127
|
+
zSin: Math.sin(zenithRad),
|
|
6128
|
+
aRad: azMath * (Math.PI / 180),
|
|
6129
|
+
w: l.weight
|
|
6130
|
+
};
|
|
6131
|
+
});
|
|
6132
|
+
for (let r = 0; r < OUT; r++) {
|
|
6133
|
+
for (let c = 0; c < OUT; c++) {
|
|
6134
|
+
const base = r * IN + c;
|
|
6135
|
+
const z5 = src[base + IN + 1];
|
|
6136
|
+
const isNoData = noDataValue !== undefined && (isNaNNoData ? Number.isNaN(z5) : z5 === noDataValue);
|
|
6137
|
+
if (isNoData) {
|
|
6138
|
+
out[r * OUT + c] = NaN;
|
|
6139
|
+
continue;
|
|
6140
|
+
}
|
|
6141
|
+
// Neighbors
|
|
6142
|
+
const z1 = src[base], z2 = src[base + 1], z3 = src[base + 2];
|
|
6143
|
+
const z4 = src[base + IN], z6 = src[base + IN + 2];
|
|
6144
|
+
const z7 = src[base + 2 * IN], z8 = src[base + 2 * IN + 1], z9 = src[base + 2 * IN + 2];
|
|
6145
|
+
const { dzdx, dzdy } = this.computeGradients(z1, z2, z3, z4, z6, z7, z8, z9, cellSizeFactor, true);
|
|
6146
|
+
const slopeRad = Math.atan(zFactor * Math.sqrt(dzdx * dzdx + dzdy * dzdy));
|
|
6147
|
+
const aspectRad = Math.atan2(dzdy, -dzdx);
|
|
6148
|
+
const cosSlope = Math.cos(slopeRad);
|
|
6149
|
+
const sinSlope = Math.sin(slopeRad);
|
|
6150
|
+
// Accumulate light from all three directions
|
|
6151
|
+
let multiHillshade = 0;
|
|
6152
|
+
for (const L of lights) {
|
|
6153
|
+
const intensity = L.zCos * cosSlope + L.zSin * sinSlope * Math.cos(L.aRad - aspectRad);
|
|
6154
|
+
multiHillshade += Math.max(0, intensity) * L.w;
|
|
6155
|
+
}
|
|
6156
|
+
out[r * OUT + c] = Math.min(255, multiHillshade * 255);
|
|
6157
|
+
}
|
|
6158
|
+
}
|
|
6159
|
+
return out;
|
|
6160
|
+
}
|
|
6161
|
+
}
|
|
6162
|
+
|
|
6163
|
+
/**
|
|
6164
|
+
* Composes Swiss relief by combining slope and hillshade kernels via LUT.
|
|
6165
|
+
* Outputs a single 0-255 relief mask suitable for baking into hypsometry (terrain)
|
|
6166
|
+
* or creating transparent glaze overlays (bitmap).
|
|
6167
|
+
*/
|
|
6168
|
+
class ReliefCompositor {
|
|
6169
|
+
/**
|
|
6170
|
+
* Precompute and cache a 256x256 LUT for Swiss relief compositing.
|
|
6171
|
+
* LUT[hillshade][slope] = (hillshade * (1.0 - (slope * weight)))
|
|
6172
|
+
* All values normalized to [0,1].
|
|
6173
|
+
* Only computed on first use of Swiss relief mode.
|
|
6174
|
+
*/
|
|
6175
|
+
static _swissReliefLUT = null;
|
|
6176
|
+
static _lastWeight = null;
|
|
6177
|
+
static getSwissReliefLUT(weight = 0.5) {
|
|
6178
|
+
// Check if LUT exists AND if the weight matches the previous calculation
|
|
6179
|
+
if (this._swissReliefLUT && this._lastWeight === weight) {
|
|
6180
|
+
return this._swissReliefLUT;
|
|
6181
|
+
}
|
|
6182
|
+
const ambient = 0.010; // 1% minimum brightness to prevent pitch black northwest slopes
|
|
6183
|
+
const lut = new Float32Array(256 * 256); // 65536 values
|
|
6184
|
+
for (let h = 0; h < 256; h++) {
|
|
6185
|
+
const hillshade = h / 255;
|
|
6186
|
+
for (let s = 0; s < 256; s++) {
|
|
6187
|
+
const slope = s / 255;
|
|
6188
|
+
// 1. Calculate the 'Swiss Contrast'
|
|
6189
|
+
const contrast = 1.0 - (slope * weight);
|
|
6190
|
+
// Swiss Formula: (Hillshade) * (1.0 - (Slope * Weight))
|
|
6191
|
+
// This results in 0.0 to 1.0 multiplier
|
|
6192
|
+
lut[(h << 8) | s] = Math.max(ambient, hillshade * contrast);
|
|
6193
|
+
}
|
|
6194
|
+
}
|
|
6195
|
+
this._swissReliefLUT = lut;
|
|
6196
|
+
this._lastWeight = weight;
|
|
6197
|
+
return lut;
|
|
6198
|
+
}
|
|
6199
|
+
/**
|
|
6200
|
+
* Compute Swiss relief compositing: slope + hillshade → 0-255 relief mask.
|
|
6201
|
+
*
|
|
6202
|
+
* @param elevation - Padded elevation raster (258×258 for kernel input)
|
|
6203
|
+
* @param options - GeoImageOptions (must include zFactor, noDataValue, swissSlopeWeight)
|
|
6204
|
+
* @param cellSize - Grid cell size in meters
|
|
6205
|
+
* @param width - Output width (typically 256)
|
|
6206
|
+
* @param height - Output height (typically 256)
|
|
6207
|
+
* @returns Uint8ClampedArray of 0-255 relief values
|
|
6208
|
+
*/
|
|
6209
|
+
static composeSwissRelief(elevation, options, cellSize, width, height) {
|
|
6210
|
+
const weight = options.swissSlopeWeight ?? 0.5;
|
|
6211
|
+
// 1. Compute slope and hillshade kernels
|
|
6212
|
+
const rawSlope = KernelGenerator.calculateSlope(elevation, cellSize, options.zFactor ?? 1, options.noDataValue);
|
|
6213
|
+
const rawHillshade = KernelGenerator.calculateMultiHillshade(elevation, cellSize, options.zFactor ?? 1, options.noDataValue);
|
|
6214
|
+
// 2. Fetch pre-computed LUT
|
|
6215
|
+
const lut = this.getSwissReliefLUT(weight);
|
|
6216
|
+
// 3. Compose relief mask: quantize slope/hillshade, apply LUT
|
|
6217
|
+
// reliefMask = 0 is reserved as noData sentinel → fully transparent in glaze output
|
|
6218
|
+
const reliefMask = new Uint8ClampedArray(width * height);
|
|
6219
|
+
// Hoist division out of loop: multiplication is faster than division
|
|
6220
|
+
const SLOPE_SCALE = 255 / 90; // ~2.833...
|
|
6221
|
+
for (let i = 0; i < width * height; i++) {
|
|
6222
|
+
// noData pixels: slope is NaN (set by KernelGenerator when z5 === noDataValue)
|
|
6223
|
+
if (isNaN(rawSlope[i])) {
|
|
6224
|
+
reliefMask[i] = 0; // sentinel: transparent in glaze
|
|
6225
|
+
continue;
|
|
6226
|
+
}
|
|
6227
|
+
// Quantize Slope: Normalize 0-90° to 0-255 integer (avoid division in loop)
|
|
6228
|
+
const sIdx = Math.max(0, Math.min(255, (rawSlope[i] * SLOPE_SCALE) | 0));
|
|
6229
|
+
// Quantize Hillshade: Ensure 0-255 integer
|
|
6230
|
+
const hIdx = Math.max(0, Math.min(255, rawHillshade[i])) | 0;
|
|
6231
|
+
// LUT Lookup: Result is 0.0 - 1.0 (float)
|
|
6232
|
+
// Clamp to 1 to ensure output stays in 1-255 (0 is reserved for noData)
|
|
6233
|
+
reliefMask[i] = Math.max(1, (lut[(hIdx << 8) | sIdx] * 255) | 0);
|
|
6234
|
+
}
|
|
6235
|
+
return reliefMask;
|
|
6236
|
+
}
|
|
5931
6237
|
}
|
|
5932
6238
|
|
|
5933
6239
|
class TerrainGenerator {
|
|
@@ -5991,7 +6297,20 @@ class TerrainGenerator {
|
|
|
5991
6297
|
height: gridHeight,
|
|
5992
6298
|
};
|
|
5993
6299
|
// 3. Kernel path: compute slope or hillshade, store as rawDerived, generate texture
|
|
5994
|
-
if (isKernel &&
|
|
6300
|
+
if (isKernel && options.useSwissRelief) {
|
|
6301
|
+
const cellSize = input.cellSizeMeters ?? ((input.bounds[2] - input.bounds[0]) / 256);
|
|
6302
|
+
// Build a separate raster for kernel computation that preserves noData samples.
|
|
6303
|
+
const kernelTerrain = this.preserveNoDataForKernel(terrain, input.rasters[0], options.noDataValue);
|
|
6304
|
+
// Compose Swiss relief using ReliefCompositor
|
|
6305
|
+
const swissReliefResult = ReliefCompositor.composeSwissRelief(kernelTerrain, options, cellSize, 256, 256);
|
|
6306
|
+
tileResult.rawDerived = swissReliefResult;
|
|
6307
|
+
if (this.hasVisualizationOptions(options)) {
|
|
6308
|
+
const cropped = this.cropRaster(meshTerrain, gridWidth, gridHeight, 256, 256);
|
|
6309
|
+
const bitmapResult = await BitmapGenerator.generate({ width: 256, height: 256, rasters: [cropped, swissReliefResult] }, { ...options, type: 'image' });
|
|
6310
|
+
tileResult.texture = bitmapResult.map;
|
|
6311
|
+
}
|
|
6312
|
+
}
|
|
6313
|
+
else if (isKernel && (options.useSlope || options.useHillshade)) {
|
|
5995
6314
|
// Use pre-computed geographic cellSize (meters/pixel) from tile indices.
|
|
5996
6315
|
// Falls back to bounds-derived estimate if not provided.
|
|
5997
6316
|
const cellSize = input.cellSizeMeters ?? ((input.bounds[2] - input.bounds[0]) / 256);
|
|
@@ -6001,23 +6320,7 @@ class TerrainGenerator {
|
|
|
6001
6320
|
console.warn('[TerrainGenerator] useSlope and useHillshade are mutually exclusive; useSlope takes precedence.');
|
|
6002
6321
|
}
|
|
6003
6322
|
// Build a separate raster for kernel computation that preserves noData samples.
|
|
6004
|
-
const kernelTerrain =
|
|
6005
|
-
const sourceRaster = input.rasters[0];
|
|
6006
|
-
const noData = options.noDataValue;
|
|
6007
|
-
if (noData !== undefined &&
|
|
6008
|
-
noData !== null &&
|
|
6009
|
-
sourceRaster &&
|
|
6010
|
-
sourceRaster.length === terrain.length) {
|
|
6011
|
-
for (let i = 0; i < terrain.length; i++) {
|
|
6012
|
-
// If the source raster marks this sample as noData, keep it as noData for the kernel.
|
|
6013
|
-
// Otherwise, use the processed terrain elevation value.
|
|
6014
|
-
kernelTerrain[i] = sourceRaster[i] == noData ? noData : terrain[i];
|
|
6015
|
-
}
|
|
6016
|
-
}
|
|
6017
|
-
else {
|
|
6018
|
-
// Fallback: no usable noData metadata or mismatched lengths; mirror existing behavior.
|
|
6019
|
-
kernelTerrain.set(terrain);
|
|
6020
|
-
}
|
|
6323
|
+
const kernelTerrain = this.preserveNoDataForKernel(terrain, input.rasters[0], options.noDataValue);
|
|
6021
6324
|
let kernelOutput;
|
|
6022
6325
|
if (options.useSlope) {
|
|
6023
6326
|
kernelOutput = KernelGenerator.calculateSlope(kernelTerrain, cellSize, zFactor, options.noDataValue);
|
|
@@ -6039,7 +6342,6 @@ class TerrainGenerator {
|
|
|
6039
6342
|
}
|
|
6040
6343
|
return tileResult;
|
|
6041
6344
|
}
|
|
6042
|
-
/** Extracts rows 1–257, cols 1–257 from a 258×258 terrain array → 257×257 for mesh generation. */
|
|
6043
6345
|
static extractMeshRaster(terrain258) {
|
|
6044
6346
|
const MESH = 257;
|
|
6045
6347
|
const IN = 258;
|
|
@@ -6052,11 +6354,38 @@ class TerrainGenerator {
|
|
|
6052
6354
|
return out;
|
|
6053
6355
|
}
|
|
6054
6356
|
static hasVisualizationOptions(options) {
|
|
6055
|
-
return !!(options.
|
|
6056
|
-
options.
|
|
6357
|
+
return !!(options.useSingleColor ||
|
|
6358
|
+
options.useHeatMap ||
|
|
6359
|
+
options.useSwissRelief ||
|
|
6057
6360
|
options.useColorsBasedOnValues ||
|
|
6058
6361
|
options.useColorClasses);
|
|
6059
6362
|
}
|
|
6363
|
+
/**
|
|
6364
|
+
* Preserve noData values in a separate raster for kernel computation.
|
|
6365
|
+
* If the source raster marks a sample as noData, keep it as noData.
|
|
6366
|
+
* Otherwise, use the processed terrain elevation value.
|
|
6367
|
+
*/
|
|
6368
|
+
static preserveNoDataForKernel(terrain, sourceRaster, noDataValue) {
|
|
6369
|
+
const kernelTerrain = new Float32Array(terrain.length);
|
|
6370
|
+
if (noDataValue !== undefined &&
|
|
6371
|
+
noDataValue !== null &&
|
|
6372
|
+
sourceRaster &&
|
|
6373
|
+
sourceRaster.length === terrain.length) {
|
|
6374
|
+
const preserveNaNNoData = Number.isNaN(noDataValue);
|
|
6375
|
+
for (let i = 0; i < terrain.length; i++) {
|
|
6376
|
+
const sourceValue = sourceRaster[i];
|
|
6377
|
+
const isNoData = preserveNaNNoData
|
|
6378
|
+
? Number.isNaN(sourceValue)
|
|
6379
|
+
: sourceValue === noDataValue;
|
|
6380
|
+
kernelTerrain[i] = isNoData ? noDataValue : terrain[i];
|
|
6381
|
+
}
|
|
6382
|
+
}
|
|
6383
|
+
else {
|
|
6384
|
+
// Fallback: no usable noData metadata or mismatched lengths; mirror existing behavior.
|
|
6385
|
+
kernelTerrain.set(terrain);
|
|
6386
|
+
}
|
|
6387
|
+
return kernelTerrain;
|
|
6388
|
+
}
|
|
6060
6389
|
static cropRaster(src, srcWidth, _srcHeight, dstWidth, dstHeight) {
|
|
6061
6390
|
const out = new Float32Array(dstWidth * dstHeight);
|
|
6062
6391
|
for (let y = 0; y < dstHeight; y++) {
|
|
@@ -6534,19 +6863,37 @@ class CogTiles {
|
|
|
6534
6863
|
async getTile(x, y, z, bounds, meshMaxError) {
|
|
6535
6864
|
let requiredSize = this.tileSize; // Default 256 for image/bitmap
|
|
6536
6865
|
if (this.options.type === 'terrain') {
|
|
6537
|
-
const isKernel = this.options.useSlope || this.options.useHillshade;
|
|
6866
|
+
const isKernel = this.options.useSlope || this.options.useHillshade || this.options.useSwissRelief;
|
|
6538
6867
|
requiredSize = this.tileSize + (isKernel ? 2 : 1); // 258 for kernel (3×3 border), 257 for normal stitching
|
|
6539
6868
|
}
|
|
6869
|
+
else if (this.options.type === 'image' && this.options.useReliefGlaze) {
|
|
6870
|
+
// Bitmap layer with relief glaze mode needs kernel padding for slope/hillshade computation
|
|
6871
|
+
requiredSize = this.tileSize + 2; // 258 for kernel
|
|
6872
|
+
}
|
|
6540
6873
|
const tileData = await this.getTileFromImage(x, y, z, requiredSize);
|
|
6541
6874
|
// Compute true ground cell size in meters from tile indices.
|
|
6542
6875
|
// Tile y in slippy-map convention → center latitude → Web Mercator distortion correction.
|
|
6543
6876
|
const latRad = Math.atan(Math.sinh(Math.PI * (1 - 2 * (y + 0.5) / Math.pow(2, z))));
|
|
6544
6877
|
const tileWidthMeters = (EARTH_CIRCUMFERENCE / Math.pow(2, z)) * Math.cos(latRad);
|
|
6545
6878
|
const cellSizeMeters = tileWidthMeters / this.tileSize;
|
|
6879
|
+
let rasters = [tileData[0]];
|
|
6880
|
+
let tileWidth = requiredSize;
|
|
6881
|
+
let tileHeight = requiredSize;
|
|
6882
|
+
// Relief glaze computation for bitmap layers
|
|
6883
|
+
// Note: For multi-band support (band selection via useChannelIndex), see issue #98
|
|
6884
|
+
if (this.options.type === 'image' && this.options.useReliefGlaze) {
|
|
6885
|
+
const elevation = tileData[0];
|
|
6886
|
+
// Pass full 258×258 padded elevation directly — KernelGenerator expects IN=258 and outputs 256×256
|
|
6887
|
+
const reliefMask = ReliefCompositor.composeSwissRelief(elevation, this.options, cellSizeMeters, this.tileSize, this.tileSize);
|
|
6888
|
+
// For glaze-only mode, pass ONLY the 256×256 relief mask
|
|
6889
|
+
rasters = [reliefMask];
|
|
6890
|
+
tileWidth = this.tileSize;
|
|
6891
|
+
tileHeight = this.tileSize;
|
|
6892
|
+
}
|
|
6546
6893
|
return this.geo.getMap({
|
|
6547
|
-
rasters
|
|
6548
|
-
width:
|
|
6549
|
-
height:
|
|
6894
|
+
rasters,
|
|
6895
|
+
width: tileWidth,
|
|
6896
|
+
height: tileHeight,
|
|
6550
6897
|
bounds,
|
|
6551
6898
|
cellSizeMeters,
|
|
6552
6899
|
}, this.options, meshMaxError);
|
|
@@ -6759,13 +7106,20 @@ class CogBitmapLayer extends CompositeLayer {
|
|
|
6759
7106
|
}
|
|
6760
7107
|
}
|
|
6761
7108
|
async getTiledBitmapData(tile) {
|
|
6762
|
-
|
|
6763
|
-
|
|
6764
|
-
|
|
6765
|
-
|
|
6766
|
-
tileData.
|
|
7109
|
+
try {
|
|
7110
|
+
// TODO - pass signal to getTile
|
|
7111
|
+
// abort request if signal is aborted
|
|
7112
|
+
const tileData = await this.state.bitmapCogTiles.getTile(tile.index.x, tile.index.y, tile.index.z);
|
|
7113
|
+
if (tileData && !this.props.pickable) {
|
|
7114
|
+
tileData.raw = null;
|
|
7115
|
+
}
|
|
7116
|
+
return tileData;
|
|
7117
|
+
}
|
|
7118
|
+
catch (error) {
|
|
7119
|
+
// Log the error and rethrow so TileLayer can surface the failure via onTileError
|
|
7120
|
+
log.warn(`Failed to load bitmap tile at ${tile.index.z}/${tile.index.x}/${tile.index.y}:`, error)();
|
|
7121
|
+
throw error;
|
|
6767
7122
|
}
|
|
6768
|
-
return tileData;
|
|
6769
7123
|
}
|
|
6770
7124
|
renderSubLayers(props) {
|
|
6771
7125
|
const SubLayerClass = this.getSubLayerClass('image', BitmapLayer);
|
|
@@ -7008,15 +7362,28 @@ class CogTerrainLayer extends CompositeLayer {
|
|
|
7008
7362
|
}
|
|
7009
7363
|
renderSubLayers(props) {
|
|
7010
7364
|
const SubLayerClass = this.getSubLayerClass('mesh', SimpleMeshLayer);
|
|
7011
|
-
const { color, wireframe,
|
|
7365
|
+
const { color, wireframe, terrainOptions } = this.props;
|
|
7012
7366
|
const { data } = props;
|
|
7013
7367
|
if (!data) {
|
|
7014
7368
|
return null;
|
|
7015
7369
|
}
|
|
7016
|
-
// const [mesh, texture] = data;
|
|
7017
7370
|
const [meshResult] = data;
|
|
7018
7371
|
const tileTexture = (!this.props.disableTexture && meshResult?.texture) ? meshResult.texture : null;
|
|
7372
|
+
const isSwiss = terrainOptions?.useSwissRelief;
|
|
7373
|
+
const disableLighting = terrainOptions?.disableLighting;
|
|
7374
|
+
const shouldDisableLighting = isSwiss || disableLighting;
|
|
7375
|
+
const lightingProps = shouldDisableLighting ? {
|
|
7376
|
+
material: {
|
|
7377
|
+
ambient: 1.0,
|
|
7378
|
+
diffuse: 0.0,
|
|
7379
|
+
shininess: 0.0,
|
|
7380
|
+
specularColor: [0, 0, 0]
|
|
7381
|
+
}
|
|
7382
|
+
} : {
|
|
7383
|
+
material: this.props.material
|
|
7384
|
+
};
|
|
7019
7385
|
return new SubLayerClass({ ...props, tileSize: props.tileSize }, {
|
|
7386
|
+
...lightingProps,
|
|
7020
7387
|
data: DUMMY_DATA,
|
|
7021
7388
|
mesh: meshResult?.map,
|
|
7022
7389
|
texture: tileTexture,
|
|
@@ -7026,7 +7393,6 @@ class CogTerrainLayer extends CompositeLayer {
|
|
|
7026
7393
|
// getPosition: (d) => [0, 0, 0],
|
|
7027
7394
|
getColor: tileTexture ? [255, 255, 255] : color,
|
|
7028
7395
|
wireframe,
|
|
7029
|
-
material,
|
|
7030
7396
|
});
|
|
7031
7397
|
}
|
|
7032
7398
|
// Update zRange of viewport
|
|
@@ -7073,13 +7439,14 @@ class CogTerrainLayer extends CompositeLayer {
|
|
|
7073
7439
|
updateTriggers: {
|
|
7074
7440
|
getTileData: {
|
|
7075
7441
|
elevationData: urlTemplateToUpdateTrigger(elevationData),
|
|
7076
|
-
// texture: urlTemplateToUpdateTrigger(texture),
|
|
7077
7442
|
meshMaxError,
|
|
7078
7443
|
elevationDecoder,
|
|
7079
|
-
// When cogTiles instance is swapped (e.g. mode switch), refetch tiles.
|
|
7080
|
-
// deck.gl keeps old tile content visible until new tiles are ready.
|
|
7081
7444
|
terrainCogTiles: this.state.terrainCogTiles,
|
|
7082
7445
|
},
|
|
7446
|
+
renderSubLayers: {
|
|
7447
|
+
disableTexture: this.props.disableTexture,
|
|
7448
|
+
terrainOptions: this.props.terrainOptions,
|
|
7449
|
+
},
|
|
7083
7450
|
},
|
|
7084
7451
|
onViewportLoad: this.onViewportLoad.bind(this),
|
|
7085
7452
|
zRange: this.state.zRange || null,
|