@gisatcz/deckgl-geolib 1.12.0-dev.5 → 2.1.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/README.md +69 -64
- package/dist/cjs/index.js +5252 -4865
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/index.min.js +3 -3
- package/dist/cjs/index.min.js.map +1 -1
- package/dist/{esm/types/cogtiles/cogtiles.d.ts → cjs/types/core/CogTiles.d.ts} +17 -47
- package/dist/cjs/types/{geoimage/geoimage.d.ts → core/GeoImage.d.ts} +7 -6
- package/dist/cjs/types/core/index.d.ts +3 -0
- package/dist/cjs/types/index.d.ts +3 -11
- package/dist/{esm/types/cogbitmaplayer → cjs/types/layers}/CogBitmapLayer.d.ts +6 -5
- package/dist/cjs/types/{cogterrainlayer → layers}/CogTerrainLayer.d.ts +15 -8
- package/dist/cjs/types/layers/index.d.ts +2 -0
- package/dist/esm/index.js +5248 -4864
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/index.min.js +3 -3
- package/dist/esm/index.min.js.map +1 -1
- package/dist/{cjs/types/cogtiles/cogtiles.d.ts → esm/types/core/CogTiles.d.ts} +17 -47
- package/dist/esm/types/{geoimage/geoimage.d.ts → core/GeoImage.d.ts} +7 -6
- package/dist/esm/types/core/index.d.ts +3 -0
- package/dist/esm/types/index.d.ts +3 -11
- package/dist/{cjs/types/cogbitmaplayer → esm/types/layers}/CogBitmapLayer.d.ts +6 -5
- package/dist/esm/types/{cogterrainlayer → layers}/CogTerrainLayer.d.ts +15 -8
- package/dist/esm/types/layers/index.d.ts +2 -0
- package/package.json +67 -26
- package/.eslintignore +0 -2
- package/.eslintrc.cjs +0 -3
- package/CHANGELOG.md +0 -166
- package/rollup.config.mjs +0 -77
- package/src/cogbitmaplayer/CogBitmapLayer.ts +0 -337
- package/src/cogbitmaplayer/README.md +0 -113
- package/src/cogterrainlayer/CogTerrainLayer.ts +0 -445
- package/src/cogterrainlayer/README.md +0 -118
- package/src/cogtiles/README.md +0 -72
- package/src/cogtiles/cogtiles.ts +0 -483
- package/src/cogtiles/lzw.js +0 -256
- package/src/geoimage/README.md +0 -129
- package/src/geoimage/delatin/index.ts +0 -495
- package/src/geoimage/geoimage.ts +0 -602
- package/src/geoimage/helpers/skirt.ts +0 -171
- package/src/index.ts +0 -11
- package/src/utilities/tileurls.ts +0 -21
- package/tsconfig.json +0 -6
- /package/dist/cjs/types/{geoimage → core}/delatin/index.d.ts +0 -0
- /package/dist/cjs/types/{geoimage → core}/helpers/skirt.d.ts +0 -0
- /package/dist/cjs/types/{utilities → utils}/tileurls.d.ts +0 -0
- /package/dist/esm/types/{geoimage → core}/delatin/index.d.ts +0 -0
- /package/dist/esm/types/{geoimage → core}/helpers/skirt.d.ts +0 -0
- /package/dist/esm/types/{utilities → utils}/tileurls.d.ts +0 -0
package/src/cogtiles/lzw.js
DELETED
|
@@ -1,256 +0,0 @@
|
|
|
1
|
-
/* eslint-disable no-mixed-operators */
|
|
2
|
-
/* eslint-disable max-len */
|
|
3
|
-
/* eslint-disable no-bitwise */
|
|
4
|
-
/* eslint-disable no-param-reassign */
|
|
5
|
-
/* eslint-disable no-plusplus */
|
|
6
|
-
/* eslint-disable max-classes-per-file */
|
|
7
|
-
/* eslint 'max-len': [1, { code: 100, comments: 999, ignoreStrings: true, ignoreUrls: true }] */
|
|
8
|
-
|
|
9
|
-
// LITERALLY STOLEN CODE FROM GITHUB
|
|
10
|
-
// NOT MY RESPONSIBILITY
|
|
11
|
-
|
|
12
|
-
function decodeRowAcc(row, stride) {
|
|
13
|
-
let length = row.length - stride;
|
|
14
|
-
let offset = 0;
|
|
15
|
-
do {
|
|
16
|
-
for (let i = stride; i > 0; i--) {
|
|
17
|
-
row[offset + stride] += row[offset];
|
|
18
|
-
offset++;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
length -= stride;
|
|
22
|
-
} while (length > 0);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
function decodeRowFloatingPoint(row, stride, bytesPerSample) {
|
|
26
|
-
let index = 0;
|
|
27
|
-
let count = row.length;
|
|
28
|
-
const wc = count / bytesPerSample;
|
|
29
|
-
|
|
30
|
-
while (count > stride) {
|
|
31
|
-
for (let i = stride; i > 0; --i) {
|
|
32
|
-
row[index + stride] += row[index];
|
|
33
|
-
++index;
|
|
34
|
-
}
|
|
35
|
-
count -= stride;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
const copy = row.slice();
|
|
39
|
-
for (let i = 0; i < wc; ++i) {
|
|
40
|
-
for (let b = 0; b < bytesPerSample; ++b) {
|
|
41
|
-
row[(bytesPerSample * i) + b] = copy[((bytesPerSample - b - 1) * wc) + i];
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
function applyPredictor(
|
|
47
|
-
block,
|
|
48
|
-
predictor,
|
|
49
|
-
width,
|
|
50
|
-
height,
|
|
51
|
-
bitsPerSample,
|
|
52
|
-
planarConfiguration,
|
|
53
|
-
) {
|
|
54
|
-
if (!predictor || predictor === 1) {
|
|
55
|
-
return block;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
for (let i = 0; i < bitsPerSample.length; ++i) {
|
|
59
|
-
if (bitsPerSample[i] % 8 !== 0) {
|
|
60
|
-
throw new Error('When decoding with predictor, only multiple of 8 bits are supported.');
|
|
61
|
-
}
|
|
62
|
-
if (bitsPerSample[i] !== bitsPerSample[0]) {
|
|
63
|
-
throw new Error('When decoding with predictor, all samples must have the same size.');
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
const bytesPerSample = bitsPerSample[0] / 8;
|
|
68
|
-
const stride = planarConfiguration === 2 ? 1 : bitsPerSample.length;
|
|
69
|
-
|
|
70
|
-
for (let i = 0; i < height; ++i) {
|
|
71
|
-
// Last strip will be truncated if height % stripHeight != 0
|
|
72
|
-
if (i * stride * width * bytesPerSample >= block.byteLength) {
|
|
73
|
-
break;
|
|
74
|
-
}
|
|
75
|
-
let row;
|
|
76
|
-
if (predictor === 2) { // horizontal prediction
|
|
77
|
-
switch (bitsPerSample[0]) {
|
|
78
|
-
case 8:
|
|
79
|
-
row = new Uint8Array(block, i * stride * width * bytesPerSample, stride * width * bytesPerSample);
|
|
80
|
-
break;
|
|
81
|
-
case 16:
|
|
82
|
-
row = new Uint16Array(block, i * stride * width * bytesPerSample, stride * width * bytesPerSample / 2);
|
|
83
|
-
break;
|
|
84
|
-
case 32:
|
|
85
|
-
row = new Uint32Array(block, i * stride * width * bytesPerSample, stride * width * bytesPerSample / 4);
|
|
86
|
-
break;
|
|
87
|
-
default:
|
|
88
|
-
throw new Error(`Predictor 2 not allowed with ${bitsPerSample[0]} bits per sample.`);
|
|
89
|
-
}
|
|
90
|
-
decodeRowAcc(row, stride, bytesPerSample);
|
|
91
|
-
} else if (predictor === 3) { // horizontal floating point
|
|
92
|
-
row = new Uint8Array(block, i * stride * width * bytesPerSample, stride * width * bytesPerSample);
|
|
93
|
-
decodeRowFloatingPoint(row, stride, bytesPerSample);
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
return block;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
class BaseDecoder {
|
|
100
|
-
async decode(fileDirectory, buffer) {
|
|
101
|
-
const decoded = await this.decodeBlock(buffer);
|
|
102
|
-
const predictor = fileDirectory.Predictor || 1;
|
|
103
|
-
if (predictor !== 1) {
|
|
104
|
-
const isTiled = !fileDirectory.StripOffsets;
|
|
105
|
-
const tileWidth = isTiled ? fileDirectory.TileWidth : fileDirectory.ImageWidth;
|
|
106
|
-
const tileHeight = isTiled
|
|
107
|
-
? fileDirectory.TileLength
|
|
108
|
-
: (
|
|
109
|
-
fileDirectory.RowsPerStrip || fileDirectory.ImageLength
|
|
110
|
-
);
|
|
111
|
-
return applyPredictor(
|
|
112
|
-
decoded,
|
|
113
|
-
predictor,
|
|
114
|
-
tileWidth,
|
|
115
|
-
tileHeight,
|
|
116
|
-
fileDirectory.BitsPerSample,
|
|
117
|
-
fileDirectory.PlanarConfiguration,
|
|
118
|
-
);
|
|
119
|
-
}
|
|
120
|
-
return decoded;
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
const MIN_BITS = 9;
|
|
125
|
-
const CLEAR_CODE = 256; // clear code
|
|
126
|
-
const EOI_CODE = 257; // end of information
|
|
127
|
-
const MAX_BYTELENGTH = 12;
|
|
128
|
-
|
|
129
|
-
function getByte(array, position, length) {
|
|
130
|
-
const d = position % 8;
|
|
131
|
-
const a = Math.floor(position / 8);
|
|
132
|
-
const de = 8 - d;
|
|
133
|
-
const ef = (position + length) - ((a + 1) * 8);
|
|
134
|
-
let fg = (8 * (a + 2)) - (position + length);
|
|
135
|
-
const dg = ((a + 2) * 8) - position;
|
|
136
|
-
fg = Math.max(0, fg);
|
|
137
|
-
if (a >= array.length) {
|
|
138
|
-
console.warn('ran off the end of the buffer before finding EOI_CODE (end on input code)');
|
|
139
|
-
return EOI_CODE;
|
|
140
|
-
}
|
|
141
|
-
let chunk1 = array[a] & ((2 ** (8 - d)) - 1);
|
|
142
|
-
chunk1 <<= (length - de);
|
|
143
|
-
let chunks = chunk1;
|
|
144
|
-
if (a + 1 < array.length) {
|
|
145
|
-
let chunk2 = array[a + 1] >>> fg;
|
|
146
|
-
chunk2 <<= Math.max(0, (length - dg));
|
|
147
|
-
chunks += chunk2;
|
|
148
|
-
}
|
|
149
|
-
if (ef > 8 && a + 2 < array.length) {
|
|
150
|
-
const hi = ((a + 3) * 8) - (position + length);
|
|
151
|
-
const chunk3 = array[a + 2] >>> hi;
|
|
152
|
-
chunks += chunk3;
|
|
153
|
-
}
|
|
154
|
-
return chunks;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
function appendReversed(dest, source) {
|
|
158
|
-
for (let i = source.length - 1; i >= 0; i--) {
|
|
159
|
-
dest.push(source[i]);
|
|
160
|
-
}
|
|
161
|
-
return dest;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
function decompress(input) {
|
|
165
|
-
const dictionaryIndex = new Uint16Array(4093);
|
|
166
|
-
const dictionaryChar = new Uint8Array(4093);
|
|
167
|
-
for (let i = 0; i <= 257; i++) {
|
|
168
|
-
dictionaryIndex[i] = 4096;
|
|
169
|
-
dictionaryChar[i] = i;
|
|
170
|
-
}
|
|
171
|
-
let dictionaryLength = 258;
|
|
172
|
-
let byteLength = MIN_BITS;
|
|
173
|
-
let position = 0;
|
|
174
|
-
|
|
175
|
-
function initDictionary() {
|
|
176
|
-
dictionaryLength = 258;
|
|
177
|
-
byteLength = MIN_BITS;
|
|
178
|
-
}
|
|
179
|
-
function getNext(array) {
|
|
180
|
-
const byte = getByte(array, position, byteLength);
|
|
181
|
-
position += byteLength;
|
|
182
|
-
return byte;
|
|
183
|
-
}
|
|
184
|
-
function addToDictionary(i, c) {
|
|
185
|
-
dictionaryChar[dictionaryLength] = c;
|
|
186
|
-
dictionaryIndex[dictionaryLength] = i;
|
|
187
|
-
dictionaryLength++;
|
|
188
|
-
return dictionaryLength - 1;
|
|
189
|
-
}
|
|
190
|
-
function getDictionaryReversed(n) {
|
|
191
|
-
const rev = [];
|
|
192
|
-
for (let i = n; i !== 4096; i = dictionaryIndex[i]) {
|
|
193
|
-
rev.push(dictionaryChar[i]);
|
|
194
|
-
}
|
|
195
|
-
return rev;
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
const result = [];
|
|
199
|
-
initDictionary();
|
|
200
|
-
const array = new Uint8Array(input);
|
|
201
|
-
let code = getNext(array);
|
|
202
|
-
let oldCode;
|
|
203
|
-
while (code !== EOI_CODE) {
|
|
204
|
-
if (code === CLEAR_CODE) {
|
|
205
|
-
initDictionary();
|
|
206
|
-
code = getNext(array);
|
|
207
|
-
while (code === CLEAR_CODE) {
|
|
208
|
-
code = getNext(array);
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
if (code === EOI_CODE) {
|
|
212
|
-
break;
|
|
213
|
-
} else if (code > CLEAR_CODE) {
|
|
214
|
-
throw new Error(`corrupted code at scanline ${code}`);
|
|
215
|
-
} else {
|
|
216
|
-
const val = getDictionaryReversed(code);
|
|
217
|
-
appendReversed(result, val);
|
|
218
|
-
oldCode = code;
|
|
219
|
-
}
|
|
220
|
-
} else if (code < dictionaryLength) {
|
|
221
|
-
const val = getDictionaryReversed(code);
|
|
222
|
-
appendReversed(result, val);
|
|
223
|
-
addToDictionary(oldCode, val[val.length - 1]);
|
|
224
|
-
oldCode = code;
|
|
225
|
-
} else {
|
|
226
|
-
const oldVal = getDictionaryReversed(oldCode);
|
|
227
|
-
if (!oldVal) {
|
|
228
|
-
throw new Error(
|
|
229
|
-
`Bogus entry. Not in dictionary,
|
|
230
|
-
${oldCode} / ${dictionaryLength},
|
|
231
|
-
position: ${position}`,
|
|
232
|
-
);
|
|
233
|
-
}
|
|
234
|
-
appendReversed(result, oldVal);
|
|
235
|
-
result.push(oldVal[oldVal.length - 1]);
|
|
236
|
-
addToDictionary(oldCode, oldVal[oldVal.length - 1]);
|
|
237
|
-
oldCode = code;
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
if (dictionaryLength + 1 >= (2 ** byteLength)) {
|
|
241
|
-
if (byteLength === MAX_BYTELENGTH) {
|
|
242
|
-
oldCode = undefined;
|
|
243
|
-
} else {
|
|
244
|
-
byteLength++;
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
code = getNext(array);
|
|
248
|
-
}
|
|
249
|
-
return new Uint8Array(result);
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
export default class LZWDecoder extends BaseDecoder {
|
|
253
|
-
decodeBlock(buffer) {
|
|
254
|
-
return decompress(buffer, false).buffer;
|
|
255
|
-
}
|
|
256
|
-
}
|
package/src/geoimage/README.md
DELETED
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
# Geoimage
|
|
2
|
-
##### A Javascript library for rendering bitmaps and terrain out of **geoTIFF** files.
|
|
3
|
-
<img src = "/images/example0crop1.png" width = "100%">
|
|
4
|
-
|
|
5
|
-
### Features
|
|
6
|
-
##### Color texture generation
|
|
7
|
-
- Create RGB pictures out of RGB geoTIFF data.
|
|
8
|
-
- Generate pictures out of non-RGB geoTIFF data with different processing options.
|
|
9
|
-
|
|
10
|
-
##### Terrain texture generation
|
|
11
|
-
- Generate heightmaps out of single-channel geoTIFF elevation data.
|
|
12
|
-
- Create tiled mesh layer which represents height values fron geoTIFF without any compression to height PNG.
|
|
13
|
-
- Created mesh is TIN generated by [martini algorithm](https://github.com/mapbox/martini).
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
##### Data visualisation options
|
|
17
|
-
- Color
|
|
18
|
-
- Transparency
|
|
19
|
-
- Heatmap (custom color scale example [here](../cogbitmaplayer/README.md#custom-heatmap-color-scale))
|
|
20
|
-
- Data slice
|
|
21
|
-
- Automatic data range
|
|
22
|
-
- Manual data range
|
|
23
|
-
- Assign color to specific data value (example [here](../cogbitmaplayer/README.md#assigning-color-to-specific-data-value))
|
|
24
|
-
|
|
25
|
-
### Data processing options
|
|
26
|
-
- `useAutoRange : boolean` - set automatic range of color gradient **(default false)**
|
|
27
|
-
- `useDataForOpacity : boolean` - visualise data with opacity of each pixel according to its value **(default false)**
|
|
28
|
-
- `alpha : number` - visualise entire image with specified opacity **(if useDataOpacity is false)**, values 0-100 **(default 100)**
|
|
29
|
-
- `useHeatMap : boolean` - generate data as a color heatmap **(default true)**
|
|
30
|
-
- `useChannel : number | null` - specify a single channel to use; first channel is equal to 1, etc... for RGB(A) imagery leave it to `null` **(default null)**
|
|
31
|
-
- `multiplier : number ` - multiplies each value **(default 1.00)**
|
|
32
|
-
- `clipLow : number | null`- generate only data greater than this **(default null)**
|
|
33
|
-
|
|
34
|
-
- `clipHigh : number | null`- generate only data less than this **(default null)**
|
|
35
|
-
- `clippedColor: chroma.Color` - set color for clipped values when using `clipLow` or `clipHigh`, **(default [0, 0, 0, 0])**
|
|
36
|
-
- `colorScale:chroma.Color[]` - array of colors, supports chroma.js color definition (more below)
|
|
37
|
-
- `colorScaleValueRange: number[]` - set min and max range values or set any array of values to set exact colors to values, **if useAutoRange is false**, **(default [0,255])**
|
|
38
|
-
- `useColorsBasedOnValues: boolean` - assign pixels colors based on defined data values **(default false)**
|
|
39
|
-
- `colorsBasedOnValues : [number, chroma.Color][]` - array of value-color pairs, used **if useColorsBasedOnValues is true**, supports chroma.js color definition such as `'red'`, `[255,0,0]`, `'#FF0000'`, etc.
|
|
40
|
-
- `useColorClasses: boolean` - determines whether pixel colors are assigned based on predefined data classes (intervals) **(default false)**
|
|
41
|
-
- `colorClasses : [chroma.Color, [number, number], [boolean, boolean]?][]` - array of color-interval(-intervalBounds) triples, where the color is defined as chroma.js color; interval is defined as [min, max] array; and optional inteval bound as [boolean, boolean] array (default is [true, false] for all intervals except the last one which is [false, true]; used **if useColorClasses is true**, the values that don't belong to any interval are visualized as `unidentifiedColor`
|
|
42
|
-
- `unidentifiedColor: chroma.Color` - set color for not identified values **if useColorsBasedOnValues or useColorClasses is true**, **(default [0, 0, 0, 0])**
|
|
43
|
-
- `nullColor : chroma.Color` - set color for noData values **(default [0, 0, 0, 0])**
|
|
44
|
-
- `useSingleColor : boolean` - display data values only with single color **(default false)**
|
|
45
|
-
- `color : chroma.Color` - set color when **if useSingleColor is true**, **(default [255, 0, 255, 255])**
|
|
46
|
-
- `blurredTexture : boolean` - define blurring behaviour for textures when zoomed in = magnification filter parameter (`gl.TEXTURE_MAG_FILTER`). Default is `true` for blurry textures (corresponds to `GL.LINEAR`), to not blur textures use `false` (corresponds to `GL.NEAREST`)
|
|
47
|
-
|
|
48
|
-
#### Chroma.Color definition
|
|
49
|
-
Type `chroma.Color` means any color definition that is supported by chroma.js such as `'red'`, `[255,0,0]`, `[255,0,0, 180]`, `'#FF0000'`,
|
|
50
|
-
etc. and [Color Brewer pallete names](https://www.datanovia.com/en/wp-content/uploads/dn-tutorials/ggplot2/figures/0101-rcolorbrewer-palette-rcolorbrewer-palettes-colorblind-friendly-1.png)
|
|
51
|
-
in this format: `chroma.brewer.Greens`
|
|
52
|
-
|
|
53
|
-
#### Additional terrain processing options
|
|
54
|
-
- `terrainMinValue: number` - noData value retrieved from input file's metadata is substitute by this value **(default 0)**
|
|
55
|
-
- `terrainSkirtHeight: number` - defines height of individual tiles edges, so there are no white spaces between individual 3D tiles **(default 100)**
|
|
56
|
-
|
|
57
|
-
[//]: # (- `terrainColor: chroma.Color` - color of terrain model **(default [133, 133, 133, 255])**)
|
|
58
|
-
|
|
59
|
-
- Setting **opacity for terrain layers**: Terrayin layer is ordinary Deck.gl layer instance, so opacity is common prop.
|
|
60
|
-
|
|
61
|
-
### Return options
|
|
62
|
-
**Method returns Image DataUrl**
|
|
63
|
-
|
|
64
|
-
- `getMap(returnFormat : "image" | "terrain", input : string | { width : number, height : number, rasters : any[] }, options?: { opacity : number })`
|
|
65
|
-
|
|
66
|
-
If `returnFormat` = `"image"` - If the input has 3 or 4 color channels, return standard RGB or RGBA image. If the input has 1 channel, data gets processed according to data processing options.
|
|
67
|
-
|
|
68
|
-
If `returnFormat` = `"terrain"` - Ignores all options except `multiplier` and returns [Mapbox Terrain-RGB](https://docs.mapbox.com/data/tilesets/guides/access-elevation-data/#decode-data)
|
|
69
|
-
|
|
70
|
-
### Basic example
|
|
71
|
-
##### Initialize the library
|
|
72
|
-
```typescript
|
|
73
|
-
import GeoImage from 'geoimage';
|
|
74
|
-
|
|
75
|
-
const g = new GeoImage();
|
|
76
|
-
```
|
|
77
|
-
##### Get bitmap
|
|
78
|
-
```typescript
|
|
79
|
-
const bitmap = await g.getMap("image", 'image.tif');
|
|
80
|
-
```
|
|
81
|
-
```typescript
|
|
82
|
-
const bitmap = await g.getMap("image", { width : 512, height : 512, rasters : [[...data]] });
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
##### Get heightmap
|
|
88
|
-
|
|
89
|
-
```typescript
|
|
90
|
-
const heightmap = await g.getMap("terrain", 'image.tif');
|
|
91
|
-
```
|
|
92
|
-
```typescript
|
|
93
|
-
const bitmap = await g.getMap("terrain", { width : 512, height : 512, rasters : [[...data]] });
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
### Advanced example
|
|
97
|
-
|
|
98
|
-
```typescript
|
|
99
|
-
//Import the library and initiate GeoImage object:
|
|
100
|
-
import GeoImage from 'geoimage';
|
|
101
|
-
|
|
102
|
-
const g = new GeoImage();
|
|
103
|
-
|
|
104
|
-
//Single-channel geotiff as a transparent heatmap with auto-rage:
|
|
105
|
-
g.useAutoRange(true);
|
|
106
|
-
g.useHeatMap(true);
|
|
107
|
-
g.alpha(100);
|
|
108
|
-
const firstImage = await g.getMap("image", 'image.tif');
|
|
109
|
-
|
|
110
|
-
//Single-channel geotiff as a transparent heatmap with manual range in meters:
|
|
111
|
-
g.useAutoRange(false);
|
|
112
|
-
g.useDataRange(0,250); //Blue at 0m, red at 250m
|
|
113
|
-
g.useHeatMap(true);
|
|
114
|
-
g.alpha(80);
|
|
115
|
-
const secondImage = await g.getBitmap("image", 'image.tif');
|
|
116
|
-
|
|
117
|
-
//Single-channel geotiff with data as transparency:
|
|
118
|
-
g.useAutoRange(true);
|
|
119
|
-
g.useHeatMap(false);
|
|
120
|
-
g.useDataForOpacity(true);
|
|
121
|
-
const thirdImage = await g.getBitmap("image", 'image.tif');
|
|
122
|
-
|
|
123
|
-
//Single-channel geotiff with data slice from 350m to 360m in custom color:
|
|
124
|
-
g.clipLow(350); //generate only data between 350m and 360m
|
|
125
|
-
g.clipHigh(360);
|
|
126
|
-
g.useHeatMap(false);
|
|
127
|
-
g.color[0,255,100];
|
|
128
|
-
const fourthImage = await g.getBitmap("image", 'image.tif');
|
|
129
|
-
```
|