@gisatcz/deckgl-geolib 1.11.2-dev.0 → 1.12.0-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/dist/cjs/index.js +20 -13
- 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 +2 -1
- package/dist/esm/index.js +20 -13
- 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 +2 -1
- package/package.json +1 -1
- package/src/cogtiles/cogtiles.ts +2 -2
- package/src/geoimage/README.md +1 -1
- package/src/geoimage/geoimage.ts +18 -12
package/dist/cjs/index.js
CHANGED
|
@@ -14766,6 +14766,7 @@ const DefaultGeoImageOptions = {
|
|
|
14766
14766
|
colorClasses: null,
|
|
14767
14767
|
alpha: 100,
|
|
14768
14768
|
useChannel: null,
|
|
14769
|
+
useChannelIndex: null,
|
|
14769
14770
|
noDataValue: undefined,
|
|
14770
14771
|
numOfChannels: undefined,
|
|
14771
14772
|
nullColor: [0, 0, 0, 0],
|
|
@@ -14804,6 +14805,7 @@ class GeoImage {
|
|
|
14804
14805
|
}
|
|
14805
14806
|
// GetHeightmap uses only "useChannel" and "multiplier" options
|
|
14806
14807
|
getHeightmap(input, options, meshMaxError) {
|
|
14808
|
+
var _a;
|
|
14807
14809
|
return __awaiter(this, void 0, void 0, function* () {
|
|
14808
14810
|
let rasters = [];
|
|
14809
14811
|
let width;
|
|
@@ -14821,15 +14823,17 @@ class GeoImage {
|
|
|
14821
14823
|
width = input.width;
|
|
14822
14824
|
height = input.height;
|
|
14823
14825
|
}
|
|
14826
|
+
const optionsLocal = Object.assign({}, options);
|
|
14824
14827
|
let channel = rasters[0];
|
|
14825
|
-
|
|
14826
|
-
|
|
14827
|
-
|
|
14828
|
+
(_a = optionsLocal.useChannelIndex) !== null && _a !== void 0 ? _a : (optionsLocal.useChannelIndex = optionsLocal.useChannel == null ? null : optionsLocal.useChannel - 1);
|
|
14829
|
+
if (options.useChannelIndex != null) {
|
|
14830
|
+
if (rasters[optionsLocal.useChannelIndex]) {
|
|
14831
|
+
channel = rasters[optionsLocal.useChannelIndex];
|
|
14828
14832
|
}
|
|
14829
14833
|
}
|
|
14830
14834
|
const terrain = new Float32Array((width + 1) * (height + 1));
|
|
14831
14835
|
const numOfChannels = channel.length / (width * height);
|
|
14832
|
-
let pixel = options.
|
|
14836
|
+
let pixel = options.useChannelIndex === null ? 0 : options.useChannelIndex;
|
|
14833
14837
|
for (let i = 0, y = 0; y < height; y++) {
|
|
14834
14838
|
for (let x = 0; x < width; x++, i++) {
|
|
14835
14839
|
const elevationValue = (options.noDataValue && channel[pixel] === options.noDataValue) ? options.terrainMinValue : channel[pixel] * options.multiplier;
|
|
@@ -14900,6 +14904,7 @@ class GeoImage {
|
|
|
14900
14904
|
});
|
|
14901
14905
|
}
|
|
14902
14906
|
getBitmap(input, options) {
|
|
14907
|
+
var _a;
|
|
14903
14908
|
return __awaiter(this, void 0, void 0, function* () {
|
|
14904
14909
|
// console.time('bitmap-generated-in');
|
|
14905
14910
|
// const optionsLocal = { ...options };
|
|
@@ -14941,13 +14946,14 @@ class GeoImage {
|
|
|
14941
14946
|
optionsLocal.nullColor = this.getColorFromChromaType(optionsLocal.nullColor);
|
|
14942
14947
|
optionsLocal.clippedColor = this.getColorFromChromaType(optionsLocal.clippedColor);
|
|
14943
14948
|
optionsLocal.color = this.getColorFromChromaType(optionsLocal.color);
|
|
14949
|
+
(_a = optionsLocal.useChannelIndex) !== null && _a !== void 0 ? _a : (optionsLocal.useChannelIndex = options.useChannel === null ? null : options.useChannel - 1);
|
|
14944
14950
|
// console.log(rasters[0])
|
|
14945
14951
|
/* console.log("raster 0 length: " + rasters[0].length)
|
|
14946
14952
|
console.log("image width: " + width)
|
|
14947
14953
|
console.log("channels: " + channels)
|
|
14948
14954
|
console.log("format: " + rasters[0].length / (width * height))
|
|
14949
14955
|
*/
|
|
14950
|
-
if (optionsLocal.
|
|
14956
|
+
if (optionsLocal.useChannelIndex == null) {
|
|
14951
14957
|
if (channels === 1) {
|
|
14952
14958
|
if (rasters[0].length / (width * height) === 1) {
|
|
14953
14959
|
const channel = rasters[0];
|
|
@@ -15014,10 +15020,10 @@ class GeoImage {
|
|
|
15014
15020
|
}
|
|
15015
15021
|
}
|
|
15016
15022
|
}
|
|
15017
|
-
else if (optionsLocal.
|
|
15023
|
+
else if (optionsLocal.useChannelIndex < optionsLocal.numOfChannels && optionsLocal.useChannelIndex >= 0) {
|
|
15018
15024
|
let channel = rasters[0];
|
|
15019
|
-
if (rasters[optionsLocal.
|
|
15020
|
-
channel = rasters[optionsLocal.
|
|
15025
|
+
if (rasters[optionsLocal.useChannelIndex]) {
|
|
15026
|
+
channel = rasters[optionsLocal.useChannelIndex];
|
|
15021
15027
|
}
|
|
15022
15028
|
// AUTO RANGE
|
|
15023
15029
|
if (optionsLocal.useAutoRange) {
|
|
@@ -15031,8 +15037,8 @@ class GeoImage {
|
|
|
15031
15037
|
});
|
|
15032
15038
|
}
|
|
15033
15039
|
else {
|
|
15034
|
-
// if user defined channel does not exist
|
|
15035
|
-
console.log(
|
|
15040
|
+
// if user defined channel does not exist
|
|
15041
|
+
console.log(`Defined channel(${options.useChannel}) or channel index(${options.useChannelIndex}) does not exist, choose a different channel or set the useChannel property to null if you want to visualize RGB(A) imagery`);
|
|
15036
15042
|
const defaultColorData = this.getDefaultColor(size, optionsLocal.nullColor);
|
|
15037
15043
|
defaultColorData.forEach((value, index) => {
|
|
15038
15044
|
imageData.data[index] = value;
|
|
@@ -15060,7 +15066,8 @@ class GeoImage {
|
|
|
15060
15066
|
}
|
|
15061
15067
|
getColorValue(dataArray, options, arrayLength, numOfChannels = 1) {
|
|
15062
15068
|
const colorScale = chroma.scale(options.colorScale).domain(options.colorScaleValueRange);
|
|
15063
|
-
|
|
15069
|
+
// channel index is equal to channel number - 1
|
|
15070
|
+
let pixel = options.useChannelIndex === null ? 0 : options.useChannelIndex;
|
|
15064
15071
|
const colorsArray = new Array(arrayLength);
|
|
15065
15072
|
// if useColorsBasedOnValues is true
|
|
15066
15073
|
const dataValues = options.colorsBasedOnValues ? options.colorsBasedOnValues.map(([first]) => first) : undefined;
|
|
@@ -15214,8 +15221,8 @@ function getDelatinTileMesh(meshMaxError, width, height, terrain) {
|
|
|
15214
15221
|
return { vertices, triangles };
|
|
15215
15222
|
}
|
|
15216
15223
|
|
|
15217
|
-
const EARTH_CIRCUMFERENCE =
|
|
15218
|
-
const EARTH_HALF_CIRCUMFERENCE =
|
|
15224
|
+
const EARTH_CIRCUMFERENCE = 2 * Math.PI * 6378137;
|
|
15225
|
+
const EARTH_HALF_CIRCUMFERENCE = EARTH_CIRCUMFERENCE / 2;
|
|
15219
15226
|
const CogTilesGeoImageOptionsDefaults = {
|
|
15220
15227
|
blurredTexture: true,
|
|
15221
15228
|
};
|