@gisatcz/deckgl-geolib 1.11.0-dev.9 → 1.11.1-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 +5 -5
- 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/cogbitmaplayer/CogBitmapLayer.d.ts +0 -2
- package/dist/cjs/types/cogterrainlayer/CogTerrainLayer.d.ts +2 -2
- package/dist/esm/index.js +5 -5
- 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/cogbitmaplayer/CogBitmapLayer.d.ts +0 -2
- package/dist/esm/types/cogterrainlayer/CogTerrainLayer.d.ts +2 -2
- package/package.json +1 -1
- package/src/cogbitmaplayer/CogBitmapLayer.ts +0 -4
- package/src/cogbitmaplayer/README.md +71 -30
- package/src/cogterrainlayer/CogTerrainLayer.ts +7 -10
- package/src/cogterrainlayer/README.md +70 -12
- package/src/geoimage/README.md +9 -9
|
@@ -43,8 +43,6 @@ export type CogBitmapLayerProps = _CogBitmapLayerProps & TileLayerProps<MeshAndT
|
|
|
43
43
|
export default class CogBitmapLayer<ExtraPropsT extends {} = {}> extends CompositeLayer<ExtraPropsT & Required<_CogBitmapLayerProps & Required<TileLayerProps<MeshAndTexture>>>> {
|
|
44
44
|
static defaultProps: DefaultProps<CogBitmapLayerProps>;
|
|
45
45
|
static layerName: string;
|
|
46
|
-
minZoom: number;
|
|
47
|
-
maxZoom: number;
|
|
48
46
|
state: {
|
|
49
47
|
initialized: boolean;
|
|
50
48
|
isTiled?: boolean;
|
|
@@ -60,12 +60,12 @@ export default class TerrainLayer<ExtraPropsT extends {} = {}> extends Composite
|
|
|
60
60
|
static defaultProps: DefaultProps<TerrainLayerProps>;
|
|
61
61
|
static layerName: string;
|
|
62
62
|
terrainUrl: string;
|
|
63
|
-
minZoom: number;
|
|
64
|
-
maxZoom: number;
|
|
65
63
|
state: {
|
|
66
64
|
isTiled?: boolean;
|
|
67
65
|
terrain?: MeshAttributes;
|
|
68
66
|
zRange?: ZRange | null;
|
|
67
|
+
minZoom: number;
|
|
68
|
+
maxZoom: number;
|
|
69
69
|
};
|
|
70
70
|
initializeState(context: any): Promise<void>;
|
|
71
71
|
init(terrainUrl: string): Promise<void>;
|
package/package.json
CHANGED
|
@@ -2,21 +2,26 @@
|
|
|
2
2
|
|
|
3
3
|
A Deck.gl-compatible layer for loading and displaying tiled COG image data
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
## Features
|
|
6
|
+
### Tiled data rendering
|
|
7
7
|
- Dynamically load and render tiled COG image data
|
|
8
|
-
|
|
8
|
+
### Data visualization
|
|
9
9
|
- Set visualization styling, colors, use heatmap, set data bounds, and more
|
|
10
|
-
|
|
10
|
+
### Compression support
|
|
11
11
|
- Supports DEFLATE data compression methods
|
|
12
12
|
|
|
13
13
|
[//]: # (- Supports JPEG, LZW nad DEFLATE data compression methods)
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
To create CogBitmapLayer, you need an URL of your COG
|
|
14
|
+
## Usage
|
|
15
|
+
### Initialize the layer
|
|
16
|
+
To create CogBitmapLayer, you need an id name, URL of your COG, declare that data is tiled,
|
|
17
|
+
and also an object containing [geoimage](../geoimage/README.md) options for data processing.
|
|
17
18
|
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
### Examples
|
|
20
|
+
> **Note**: The examples below showcase only a subset of available rendering options.
|
|
21
|
+
> To view all configurable options for `CogBitmapLayer`,
|
|
22
|
+
> refer to the [geoimage](../geoimage/README.md) library documentation.
|
|
23
|
+
|
|
24
|
+
Import package into project and create bitmap layer
|
|
20
25
|
|
|
21
26
|
```typescript
|
|
22
27
|
import geolib from '@gisatcz/deckgl-geolib';
|
|
@@ -25,41 +30,77 @@ const CogBitmapLayer = geolib.CogBitmapLayer;
|
|
|
25
30
|
```
|
|
26
31
|
Display simple rgb image. If you don't specify a channel to process, it defaults to grayscale, RGB, or RGBA depending on the channel count
|
|
27
32
|
```typescript
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
33
|
+
const cogLayer = new CogBitmapLayer(
|
|
34
|
+
id: 'cog_bitmap_name',
|
|
35
|
+
rasterData: 'cog_bitmap_data_url.tif',
|
|
36
|
+
isTiled: true,
|
|
37
|
+
cogBitmapOptions: {
|
|
38
|
+
type: 'image',
|
|
39
|
+
}
|
|
40
|
+
);
|
|
32
41
|
```
|
|
33
42
|
Display the second channel as a heatmap with data from 0 to 1000
|
|
34
43
|
- Currently, when `useAutoRange` is `true`, min and max data value for each image is calculated separately, thus it is recommended to set min and max values in `colorScaleValueRange`.
|
|
35
44
|
|
|
36
45
|
```typescript
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
46
|
+
const cogLayer = new CogBitmapLayer(
|
|
47
|
+
id: 'cog_bitmap_name',
|
|
48
|
+
rasterData: 'cog_bitmap_data_url.tif',
|
|
49
|
+
isTiled: true,
|
|
50
|
+
cogBitmapOptions: {
|
|
51
|
+
type: 'image',
|
|
52
|
+
// useAutoRange: true,
|
|
53
|
+
colorScaleValueRange: [0,1000]
|
|
54
|
+
useChannel: 1,
|
|
55
|
+
}
|
|
56
|
+
);
|
|
41
57
|
```
|
|
42
58
|
<a name='custom-heatmap-color-scale'></a>
|
|
43
59
|
Display the second channel as a heatmap with data from 0 to 1000 with custom color scale
|
|
44
60
|
|
|
45
61
|
```typescript
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
62
|
+
const cogLayer = new CogBitmapLayer(
|
|
63
|
+
id: 'cog_bitmap_name',
|
|
64
|
+
rasterData: 'cog_bitmap_data_url.tif',
|
|
65
|
+
isTiled: true,
|
|
66
|
+
cogBitmapOptions: {
|
|
67
|
+
type: 'image',
|
|
68
|
+
colorScaleValueRange: [0,1000]
|
|
69
|
+
useChannel: 1,
|
|
70
|
+
useHeatmap: true,
|
|
71
|
+
colorScale: ['green', '#3182bd', [255, 0, 0]]
|
|
72
|
+
}
|
|
73
|
+
);
|
|
50
74
|
```
|
|
51
75
|
Display the third channel as a green color and only show data from 100 to 200, the clipped data should be visualized with yellow color
|
|
52
76
|
```typescript
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
77
|
+
const cogLayer = new CogBitmapLayer(
|
|
78
|
+
id: 'cog_bitmap_name',
|
|
79
|
+
rasterData: 'cog_bitmap_data_url.tif',
|
|
80
|
+
isTiled: true,
|
|
81
|
+
cogBitmapOptions: {
|
|
82
|
+
type: 'image',
|
|
83
|
+
useChannel: 2,
|
|
84
|
+
useSingleColor: true,
|
|
85
|
+
clipLow: 100,
|
|
86
|
+
clipHigh: 200,
|
|
87
|
+
color: [0, 255, 0, 255],
|
|
88
|
+
clippedColor: 'yellow'
|
|
89
|
+
}
|
|
90
|
+
);
|
|
57
91
|
```
|
|
58
92
|
<a name='assigning-color-to-specific-data-value'></a>
|
|
59
|
-
|
|
93
|
+
Assign color to specific data values
|
|
60
94
|
```typescript
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
95
|
+
const cogLayer = new CogBitmapLayer(
|
|
96
|
+
id: 'cog_bitmap_name',
|
|
97
|
+
rasterData: 'cog_bitmap_data_url.tif',
|
|
98
|
+
isTiled: true,
|
|
99
|
+
cogBitmapOptions: {
|
|
100
|
+
type: 'image',
|
|
101
|
+
useChannel: 20,
|
|
102
|
+
useColorsBasedOnValues: true,
|
|
103
|
+
colorsBasedOnValues: [[1, 'red'], [2, [0, 0, 255]], [3, '#00FF00']]
|
|
104
|
+
}
|
|
105
|
+
);
|
|
65
106
|
```
|
|
@@ -186,14 +186,12 @@ export default class TerrainLayer<ExtraPropsT extends {} = {}> extends Composite
|
|
|
186
186
|
|
|
187
187
|
terrainUrl: string;
|
|
188
188
|
|
|
189
|
-
minZoom: number;
|
|
190
|
-
|
|
191
|
-
maxZoom: number;
|
|
192
|
-
|
|
193
189
|
state!: {
|
|
194
190
|
isTiled?: boolean;
|
|
195
191
|
terrain?: MeshAttributes;
|
|
196
192
|
zRange?: ZRange | null;
|
|
193
|
+
minZoom: number;
|
|
194
|
+
maxZoom: number;
|
|
197
195
|
};
|
|
198
196
|
|
|
199
197
|
async initializeState(context: any) {
|
|
@@ -212,9 +210,10 @@ export default class TerrainLayer<ExtraPropsT extends {} = {}> extends Composite
|
|
|
212
210
|
// this.tileSize = this.terrainCogTiles.getTileSize(cog);
|
|
213
211
|
|
|
214
212
|
const zoomRange = this.state.terrainCogTiles.getZoomRange(cog);
|
|
215
|
-
[this.minZoom, this.maxZoom] = zoomRange;
|
|
216
213
|
|
|
217
|
-
|
|
214
|
+
const [minZoom, maxZoom] = zoomRange;
|
|
215
|
+
|
|
216
|
+
this.setState({ initialized: true, minZoom, maxZoom });
|
|
218
217
|
}
|
|
219
218
|
|
|
220
219
|
updateState({ props, oldProps }: UpdateParameters<this>): void {
|
|
@@ -379,8 +378,6 @@ export default class TerrainLayer<ExtraPropsT extends {} = {}> extends Composite
|
|
|
379
378
|
meshMaxError,
|
|
380
379
|
elevationDecoder,
|
|
381
380
|
tileSize,
|
|
382
|
-
maxZoom,
|
|
383
|
-
minZoom,
|
|
384
381
|
extent,
|
|
385
382
|
maxRequests,
|
|
386
383
|
onTileLoad,
|
|
@@ -410,8 +407,8 @@ export default class TerrainLayer<ExtraPropsT extends {} = {}> extends Composite
|
|
|
410
407
|
onViewportLoad: this.onViewportLoad.bind(this),
|
|
411
408
|
zRange: this.state.zRange || null,
|
|
412
409
|
tileSize,
|
|
413
|
-
|
|
414
|
-
|
|
410
|
+
minZoom: this.state.minZoom,
|
|
411
|
+
maxZoom: this.state.maxZoom,
|
|
415
412
|
extent,
|
|
416
413
|
maxRequests,
|
|
417
414
|
onTileLoad,
|
|
@@ -2,23 +2,24 @@
|
|
|
2
2
|
|
|
3
3
|
A Deck.gl-compatible layer for loading and displaying tiled COG height data
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## Features
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
### Tiled terrain rendering
|
|
8
8
|
- Dynamically load and render tiled COG height data
|
|
9
9
|
- Overlay another COG as a bitmap, or supply a tile service template url.
|
|
10
|
-
|
|
10
|
+
### Data visualization
|
|
11
11
|
- Multiply terrain height
|
|
12
12
|
- Clamp COG data on top of generated terrain
|
|
13
13
|
- Set visualization styling, colors, use heatmap, set data bounds, and more
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
## Usage
|
|
16
|
+
### Initialize the layer
|
|
17
17
|
To create CogTerrainLayer, you need an URL of your COG and also an object containing [geoimage](../geoimage/README.md) options for data processing.
|
|
18
|
-
For this layer, only needed options are `type`, and optionally `
|
|
18
|
+
For this layer, only needed terrain options are `type`, and optionally `multiplier`, `terrainSkirtHeight`, `terrainMinValue`.
|
|
19
|
+
|
|
19
20
|
You can also specify another COG as an overlay, and it's corresponding options, or just supply a tile service template url. Overlay options use all of [geoimage](../geoimage/README.md) options and work only with COG
|
|
20
21
|
|
|
21
|
-
|
|
22
|
+
### Example
|
|
22
23
|
Import package into project and create terrain layer
|
|
23
24
|
|
|
24
25
|
```typescript
|
|
@@ -29,15 +30,72 @@ const CogTerrainLayer = geolib.CogTerrainLayer;
|
|
|
29
30
|
Display simple terrain
|
|
30
31
|
```typescript
|
|
31
32
|
const cogLayer = new CogTerrainLayer(
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
id: 'cog_terrain_name',
|
|
34
|
+
elevationData: 'cog_terrain_data_url.tif',
|
|
35
|
+
isTiled: true,
|
|
36
|
+
tileSize: 256,
|
|
37
|
+
operation: 'terrain+draw',
|
|
38
|
+
terrainOptions: {
|
|
39
|
+
type: 'terrain',
|
|
40
|
+
}
|
|
41
|
+
);
|
|
42
|
+
```
|
|
43
|
+
Display multiplied terrain with custom skirt height
|
|
44
|
+
(height of individual tiles edges, so there are no white spaces between individual 3D tiles) and defined minimal terrain value.
|
|
45
|
+
```typescript
|
|
46
|
+
const cogLayer = new CogTerrainLayer(
|
|
47
|
+
id: 'cog_terrain_name',
|
|
48
|
+
elevationData: 'cog_terrain_data_url.tif',
|
|
49
|
+
isTiled: true,
|
|
50
|
+
tileSize: 256,
|
|
51
|
+
operation: 'terrain+draw',
|
|
52
|
+
terrainOptions: {
|
|
53
|
+
type: 'terrain',
|
|
54
|
+
multiplier: 1,
|
|
55
|
+
terrainSkirtHeight: 1,
|
|
56
|
+
terrainMinValue: 200,
|
|
57
|
+
}
|
|
58
|
+
);
|
|
59
|
+
```
|
|
60
|
+
Adjust `meshMaxError`: Martini error tolerance in meters, smaller number -> more detailed mesh, **(default 4.0)**.
|
|
61
|
+
```typescript
|
|
62
|
+
const cogLayer = new CogTerrainLayer(
|
|
63
|
+
id: 'cog_terrain_name',
|
|
64
|
+
elevationData: 'cog_terrain_data_url.tif',
|
|
65
|
+
isTiled: true,
|
|
66
|
+
useChannel: null,
|
|
67
|
+
tileSize: 256,
|
|
68
|
+
meshMaxError: 1,
|
|
69
|
+
operation: 'terrain+draw',
|
|
70
|
+
terrainOptions: {
|
|
71
|
+
type: 'terrain',
|
|
72
|
+
}
|
|
35
73
|
);
|
|
36
74
|
```
|
|
37
75
|
|
|
76
|
+
[//]: # (TODO check if useChannel works properly)
|
|
77
|
+
Adjust `opacity` and display second channel.
|
|
78
|
+
```typescript
|
|
79
|
+
const cogLayer = new CogTerrainLayer(
|
|
80
|
+
id: 'cog_terrain_name',
|
|
81
|
+
elevationData: 'cog_terrain_data_url.tif',
|
|
82
|
+
opacity: 0.5,
|
|
83
|
+
isTiled: true,
|
|
84
|
+
useChannel: 1,
|
|
85
|
+
tileSize: 256,
|
|
86
|
+
meshMaxError: 1,
|
|
87
|
+
operation: 'terrain+draw',
|
|
88
|
+
terrainOptions: {
|
|
89
|
+
type: 'terrain',
|
|
90
|
+
}
|
|
91
|
+
);
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
[//]: # (TODO update overlay generation)
|
|
95
|
+
|
|
38
96
|
Display terrain with tile service overlay
|
|
39
97
|
```typescript
|
|
40
|
-
const
|
|
98
|
+
const cogLayer = new CogTerrainLayer(
|
|
41
99
|
'cog_data_url.tif',
|
|
42
100
|
{type:'terrain'},
|
|
43
101
|
'tile-service.com/{z}/{x}/{y}.png'
|
|
@@ -45,7 +103,7 @@ const terrainLayer = new CogTerrainLayer(
|
|
|
45
103
|
```
|
|
46
104
|
Display terrain with stylized COG overlay
|
|
47
105
|
```typescript
|
|
48
|
-
const
|
|
106
|
+
const cogLayer = new CogTerrainLayer(
|
|
49
107
|
'cog.tif',
|
|
50
108
|
{type:'terrain'},
|
|
51
109
|
'cog-overlay.tif',
|
package/src/geoimage/README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# Geoimage
|
|
2
|
-
##### A Javascript library for
|
|
2
|
+
##### A Javascript library for rendering bitmaps and terrain out of **geoTIFF** files.
|
|
3
3
|
<img src = "/images/example0crop1.png" width = "100%">
|
|
4
4
|
|
|
5
5
|
### Features
|
|
@@ -9,7 +9,9 @@
|
|
|
9
9
|
|
|
10
10
|
##### Terrain texture generation
|
|
11
11
|
- Generate heightmaps out of single-channel geoTIFF elevation data.
|
|
12
|
-
-
|
|
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
|
+
|
|
13
15
|
|
|
14
16
|
##### Data visualisation options
|
|
15
17
|
- Color
|
|
@@ -19,6 +21,7 @@
|
|
|
19
21
|
- Automatic data range
|
|
20
22
|
- Manual data range
|
|
21
23
|
- Assign color to specific data value (example [here](../cogbitmaplayer/README.md#assigning-color-to-specific-data-value))
|
|
24
|
+
|
|
22
25
|
### Data processing options
|
|
23
26
|
- `useAutoRange : boolean` - set automatic range of color gradient **(default false)**
|
|
24
27
|
- `useDataForOpacity : boolean` - visualise data with opacity of each pixel according to its value **(default false)**
|
|
@@ -48,15 +51,12 @@ etc. and [Color Brewer pallete names](https://www.datanovia.com/en/wp-content/up
|
|
|
48
51
|
in this format: `chroma.brewer.Greens`
|
|
49
52
|
|
|
50
53
|
#### Additional terrain processing options
|
|
51
|
-
- `terrainMinValue: number` - noData value
|
|
54
|
+
- `terrainMinValue: number` - noData value retrieved from input file's metadata is substitute by this value **(default 0)**
|
|
52
55
|
- `terrainSkirtHeight: number` - defines height of individual tiles edges, so there are no white spaces between individual 3D tiles **(default 100)**
|
|
53
|
-
- `terrainColor: chroma.Color` - color of terrain model **(default [133, 133, 133, 255])**
|
|
54
56
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
the overlay is taken from its definition in `bitmapOptions`, not from `terrainOptions`
|
|
59
|
-
(which is recommended to be set to 100 unless the opacities are combined).
|
|
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
60
|
|
|
61
61
|
### Return options
|
|
62
62
|
**Method returns Image DataUrl**
|