@deck.gl/geo-layers 9.0.0-beta.8 → 9.0.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/dist.dev.js +2195 -1495
- package/dist/index.cjs +11 -9
- package/dist/index.cjs.map +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/mvt-layer/mvt-layer.d.ts +8 -8
- package/dist/mvt-layer/mvt-layer.d.ts.map +1 -1
- package/dist/mvt-layer/mvt-layer.js +0 -5
- package/dist/tile-3d-layer/tile-3d-layer.d.ts +15 -1
- package/dist/tile-3d-layer/tile-3d-layer.d.ts.map +1 -1
- package/dist/tile-layer/tile-layer.d.ts +11 -2
- package/dist/tile-layer/tile-layer.d.ts.map +1 -1
- package/dist/tile-layer/tile-layer.js +6 -3
- package/dist/tileset-2d/tileset-2d.d.ts +2 -0
- package/dist/tileset-2d/tileset-2d.d.ts.map +1 -1
- package/dist/tileset-2d/tileset-2d.js +5 -3
- package/dist.min.js +12 -12
- package/package.json +19 -19
- package/src/index.ts +2 -2
- package/src/mvt-layer/mvt-layer.ts +17 -16
- package/src/tile-layer/tile-layer.ts +22 -5
- package/src/tileset-2d/tileset-2d.ts +7 -4
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "deck.gl layers supporting geospatial use cases and GIS formats",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"version": "9.0.0
|
|
6
|
+
"version": "9.0.0",
|
|
7
7
|
"publishConfig": {
|
|
8
8
|
"access": "public"
|
|
9
9
|
},
|
|
@@ -38,16 +38,16 @@
|
|
|
38
38
|
"prepublishOnly": "npm run build-bundle && npm run build-bundle -- --env=dev"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@loaders.gl/3d-tiles": "^4.
|
|
42
|
-
"@loaders.gl/gis": "^4.
|
|
43
|
-
"@loaders.gl/loader-utils": "^4.
|
|
44
|
-
"@loaders.gl/mvt": "^4.
|
|
45
|
-
"@loaders.gl/schema": "^4.
|
|
46
|
-
"@loaders.gl/terrain": "^4.
|
|
47
|
-
"@loaders.gl/tiles": "^4.
|
|
48
|
-
"@loaders.gl/wms": "^4.
|
|
49
|
-
"@luma.gl/gltf": "9.0.
|
|
50
|
-
"@luma.gl/shadertools": "9.0.
|
|
41
|
+
"@loaders.gl/3d-tiles": "^4.1.4",
|
|
42
|
+
"@loaders.gl/gis": "^4.1.4",
|
|
43
|
+
"@loaders.gl/loader-utils": "^4.1.4",
|
|
44
|
+
"@loaders.gl/mvt": "^4.1.4",
|
|
45
|
+
"@loaders.gl/schema": "^4.1.4",
|
|
46
|
+
"@loaders.gl/terrain": "^4.1.4",
|
|
47
|
+
"@loaders.gl/tiles": "^4.1.4",
|
|
48
|
+
"@loaders.gl/wms": "^4.1.4",
|
|
49
|
+
"@luma.gl/gltf": "^9.0.6",
|
|
50
|
+
"@luma.gl/shadertools": "^9.0.6",
|
|
51
51
|
"@math.gl/core": "^4.0.0",
|
|
52
52
|
"@math.gl/culling": "^4.0.0",
|
|
53
53
|
"@math.gl/web-mercator": "^4.0.0",
|
|
@@ -56,13 +56,13 @@
|
|
|
56
56
|
"long": "^3.2.0"
|
|
57
57
|
},
|
|
58
58
|
"peerDependencies": {
|
|
59
|
-
"@deck.gl/core": "^9.0.0
|
|
60
|
-
"@deck.gl/extensions": "^9.0.0
|
|
61
|
-
"@deck.gl/layers": "^9.0.0
|
|
62
|
-
"@deck.gl/mesh-layers": "^9.0.0
|
|
63
|
-
"@loaders.gl/core": "^4.
|
|
64
|
-
"@luma.gl/core": "9.0.0
|
|
65
|
-
"@luma.gl/engine": "9.0.0
|
|
59
|
+
"@deck.gl/core": "^9.0.0",
|
|
60
|
+
"@deck.gl/extensions": "^9.0.0",
|
|
61
|
+
"@deck.gl/layers": "^9.0.0",
|
|
62
|
+
"@deck.gl/mesh-layers": "^9.0.0",
|
|
63
|
+
"@loaders.gl/core": "^4.1.0",
|
|
64
|
+
"@luma.gl/core": "^9.0.0",
|
|
65
|
+
"@luma.gl/engine": "^9.0.0"
|
|
66
66
|
},
|
|
67
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "fcb5ccf0a899e651949b24986488211e278e9321"
|
|
68
68
|
}
|
package/src/index.ts
CHANGED
|
@@ -40,12 +40,12 @@ export type {H3ClusterLayerProps} from './h3-layers/h3-cluster-layer';
|
|
|
40
40
|
export type {H3HexagonLayerProps} from './h3-layers/h3-hexagon-layer';
|
|
41
41
|
export type {GreatCircleLayerProps} from './great-circle-layer/great-circle-layer';
|
|
42
42
|
export type {S2LayerProps} from './s2-layer/s2-layer';
|
|
43
|
-
export type {TileLayerProps} from './tile-layer/tile-layer';
|
|
43
|
+
export type {TileLayerProps, TileLayerPickingInfo} from './tile-layer/tile-layer';
|
|
44
44
|
export type {TripsLayerProps} from './trips-layer/trips-layer';
|
|
45
45
|
export type {QuadkeyLayerProps} from './quadkey-layer/quadkey-layer';
|
|
46
46
|
export type {TerrainLayerProps} from './terrain-layer/terrain-layer';
|
|
47
47
|
export type {Tile3DLayerProps} from './tile-3d-layer/tile-3d-layer';
|
|
48
|
-
export type {MVTLayerProps} from './mvt-layer/mvt-layer';
|
|
48
|
+
export type {MVTLayerProps, MVTLayerPickingInfo} from './mvt-layer/mvt-layer';
|
|
49
49
|
export type {GeoCellLayerProps as _GeoCellLayerProps} from './geo-cell-layer/GeoCellLayer';
|
|
50
50
|
|
|
51
51
|
// Tileset2D
|
|
@@ -18,12 +18,12 @@ import {binaryToGeojson} from '@loaders.gl/gis';
|
|
|
18
18
|
|
|
19
19
|
import type {Loader} from '@loaders.gl/loader-utils';
|
|
20
20
|
import type {BinaryFeatureCollection} from '@loaders.gl/schema';
|
|
21
|
-
import type {Feature} from 'geojson';
|
|
21
|
+
import type {Feature, Geometry} from 'geojson';
|
|
22
22
|
|
|
23
23
|
import {transform} from './coordinate-transform';
|
|
24
24
|
import findIndexBinary from './find-index-binary';
|
|
25
25
|
|
|
26
|
-
import TileLayer, {
|
|
26
|
+
import TileLayer, {TileLayerPickingInfo, TileLayerProps} from '../tile-layer/tile-layer';
|
|
27
27
|
|
|
28
28
|
import type {Tileset2DProps, TileLoadProps, GeoBoundingBox} from '../tileset-2d/index';
|
|
29
29
|
import {
|
|
@@ -62,13 +62,20 @@ export type TileJson = {
|
|
|
62
62
|
|
|
63
63
|
type ParsedMvtTile = Feature[] | BinaryFeatureCollection;
|
|
64
64
|
|
|
65
|
+
export type MVTLayerPickingInfo<FeaturePropertiesT = {}> = TileLayerPickingInfo<
|
|
66
|
+
ParsedMvtTile,
|
|
67
|
+
PickingInfo<Feature<Geometry, FeaturePropertiesT>>
|
|
68
|
+
>;
|
|
69
|
+
|
|
65
70
|
/** All props supported by the MVTLayer */
|
|
66
|
-
export type MVTLayerProps = _MVTLayerProps &
|
|
67
|
-
Omit<GeoJsonLayerProps, 'data'> &
|
|
71
|
+
export type MVTLayerProps<FeaturePropertiesT = unknown> = _MVTLayerProps<FeaturePropertiesT> &
|
|
68
72
|
Omit<TileLayerProps<ParsedMvtTile>, 'data'>;
|
|
69
73
|
|
|
70
74
|
/** Props added by the MVTLayer */
|
|
71
|
-
export type _MVTLayerProps =
|
|
75
|
+
export type _MVTLayerProps<FeaturePropertiesT> = Omit<
|
|
76
|
+
GeoJsonLayerProps<FeaturePropertiesT>,
|
|
77
|
+
'data'
|
|
78
|
+
> & {
|
|
72
79
|
data: TileJson | URLTemplate;
|
|
73
80
|
|
|
74
81
|
/** Called if `data` is a TileJSON URL when it is successfully fetched. */
|
|
@@ -98,10 +105,10 @@ export type _MVTLayerProps = {
|
|
|
98
105
|
type ContentWGS84Cache = {_contentWGS84?: Feature[]};
|
|
99
106
|
|
|
100
107
|
/** Render data formatted as [Mapbox Vector Tiles](https://docs.mapbox.com/vector-tiles/specification/). */
|
|
101
|
-
export default class MVTLayer<
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
> {
|
|
108
|
+
export default class MVTLayer<
|
|
109
|
+
FeaturePropertiesT = any,
|
|
110
|
+
ExtraProps extends {} = {}
|
|
111
|
+
> extends TileLayer<ParsedMvtTile, Required<_MVTLayerProps<FeaturePropertiesT>> & ExtraProps> {
|
|
105
112
|
static layerName = 'MVTLayer';
|
|
106
113
|
static defaultProps = defaultProps;
|
|
107
114
|
|
|
@@ -114,12 +121,6 @@ export default class MVTLayer<ExtraProps extends {} = {}> extends TileLayer<
|
|
|
114
121
|
hoveredFeatureLayerName: string | null;
|
|
115
122
|
};
|
|
116
123
|
|
|
117
|
-
constructor(...propObjects: MVTLayerProps[]) {
|
|
118
|
-
// Force externally visible props type, as it is not possible modify via extension
|
|
119
|
-
// @ts-ignore
|
|
120
|
-
super(...propObjects);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
124
|
initializeState(): void {
|
|
124
125
|
super.initializeState();
|
|
125
126
|
// GlobeView doesn't work well with binary data
|
|
@@ -302,7 +303,7 @@ export default class MVTLayer<ExtraProps extends {} = {}> extends TileLayer<
|
|
|
302
303
|
}
|
|
303
304
|
}
|
|
304
305
|
|
|
305
|
-
getPickingInfo(params: GetPickingInfoParams):
|
|
306
|
+
getPickingInfo(params: GetPickingInfoParams): MVTLayerPickingInfo<FeaturePropertiesT> {
|
|
306
307
|
const info = super.getPickingInfo(params);
|
|
307
308
|
|
|
308
309
|
const isWGS84 = Boolean(this.context.viewport.resolution);
|
|
@@ -44,6 +44,7 @@ const defaultProps: DefaultProps<TileLayerProps> = {
|
|
|
44
44
|
refinementStrategy: STRATEGY_DEFAULT,
|
|
45
45
|
zRange: null,
|
|
46
46
|
maxRequests: 6,
|
|
47
|
+
debounceTime: 0,
|
|
47
48
|
zoomOffset: 0
|
|
48
49
|
};
|
|
49
50
|
|
|
@@ -128,6 +129,13 @@ type _TileLayerProps<DataT> = {
|
|
|
128
129
|
*/
|
|
129
130
|
maxRequests?: number;
|
|
130
131
|
|
|
132
|
+
/**
|
|
133
|
+
* Queue tile requests until no new tiles have been requested for at least `debounceTime` milliseconds.
|
|
134
|
+
*
|
|
135
|
+
* @default 0
|
|
136
|
+
*/
|
|
137
|
+
debounceTime?: number;
|
|
138
|
+
|
|
131
139
|
/**
|
|
132
140
|
* This offset changes the zoom level at which the tiles are fetched.
|
|
133
141
|
*
|
|
@@ -138,8 +146,14 @@ type _TileLayerProps<DataT> = {
|
|
|
138
146
|
zoomOffset?: number;
|
|
139
147
|
};
|
|
140
148
|
|
|
141
|
-
export type
|
|
149
|
+
export type TileLayerPickingInfo<
|
|
150
|
+
DataT = any,
|
|
151
|
+
SubLayerPickingInfo = PickingInfo
|
|
152
|
+
> = SubLayerPickingInfo & {
|
|
153
|
+
/** The picked tile */
|
|
142
154
|
tile?: Tile2DHeader<DataT>;
|
|
155
|
+
/** the tile that emitted the picking event */
|
|
156
|
+
sourceTile: Tile2DHeader<DataT>;
|
|
143
157
|
};
|
|
144
158
|
|
|
145
159
|
/**
|
|
@@ -221,6 +235,7 @@ export default class TileLayer<DataT = any, ExtraPropsT extends {} = {}> extends
|
|
|
221
235
|
maxZoom,
|
|
222
236
|
minZoom,
|
|
223
237
|
maxRequests,
|
|
238
|
+
debounceTime,
|
|
224
239
|
zoomOffset
|
|
225
240
|
} = this.props;
|
|
226
241
|
|
|
@@ -233,6 +248,7 @@ export default class TileLayer<DataT = any, ExtraPropsT extends {} = {}> extends
|
|
|
233
248
|
refinementStrategy,
|
|
234
249
|
extent,
|
|
235
250
|
maxRequests,
|
|
251
|
+
debounceTime,
|
|
236
252
|
zoomOffset,
|
|
237
253
|
|
|
238
254
|
getTileData: this.getTileData.bind(this),
|
|
@@ -324,12 +340,13 @@ export default class TileLayer<DataT = any, ExtraPropsT extends {} = {}> extends
|
|
|
324
340
|
return null;
|
|
325
341
|
}
|
|
326
342
|
|
|
327
|
-
getPickingInfo(
|
|
328
|
-
const sourceTile = (sourceLayer as any).props.tile;
|
|
343
|
+
getPickingInfo(params: GetPickingInfoParams): TileLayerPickingInfo<DataT> {
|
|
344
|
+
const sourceTile: Tile2DHeader<DataT> = (params.sourceLayer as any).props.tile;
|
|
345
|
+
const info = params.info as TileLayerPickingInfo<DataT>;
|
|
329
346
|
if (info.picked) {
|
|
330
|
-
|
|
347
|
+
info.tile = sourceTile;
|
|
331
348
|
}
|
|
332
|
-
|
|
349
|
+
info.sourceTile = sourceTile;
|
|
333
350
|
return info;
|
|
334
351
|
}
|
|
335
352
|
|
|
@@ -73,6 +73,8 @@ export type Tileset2DProps<DataT = any> = {
|
|
|
73
73
|
zRange?: ZRange | null;
|
|
74
74
|
/** The maximum number of concurrent getTileData calls. @default 6 */
|
|
75
75
|
maxRequests?: number;
|
|
76
|
+
/** Queue tile requests until no new tiles have been requested for at least `debounceTime` milliseconds. @default 0 */
|
|
77
|
+
debounceTime?: number;
|
|
76
78
|
/** Changes the zoom level at which the tiles are fetched. Needs to be an integer. @default 0 */
|
|
77
79
|
zoomOffset?: number;
|
|
78
80
|
|
|
@@ -101,6 +103,7 @@ export const DEFAULT_TILESET2D_PROPS: Omit<Required<Tileset2DProps>, 'getTileDat
|
|
|
101
103
|
refinementStrategy: 'best-available',
|
|
102
104
|
zRange: null,
|
|
103
105
|
maxRequests: 6,
|
|
106
|
+
debounceTime: 0,
|
|
104
107
|
zoomOffset: 0,
|
|
105
108
|
|
|
106
109
|
// onTileLoad: (tile: Tile2DHeader) => void, // onTileUnload: (tile: Tile2DHeader) => void, // onTileError: (error: any, tile: Tile2DHeader) => void, /** Called when all tiles in the current viewport are loaded. */
|
|
@@ -140,6 +143,7 @@ export class Tileset2D {
|
|
|
140
143
|
*/
|
|
141
144
|
constructor(opts: Tileset2DProps) {
|
|
142
145
|
this.opts = {...DEFAULT_TILESET2D_PROPS, ...opts};
|
|
146
|
+
this.setOptions(this.opts);
|
|
143
147
|
|
|
144
148
|
this.onTileLoad = tile => {
|
|
145
149
|
this.opts.onTileLoad?.(tile);
|
|
@@ -150,8 +154,9 @@ export class Tileset2D {
|
|
|
150
154
|
};
|
|
151
155
|
|
|
152
156
|
this._requestScheduler = new RequestScheduler({
|
|
153
|
-
|
|
154
|
-
|
|
157
|
+
throttleRequests: this.opts.maxRequests > 0 || this.opts.debounceTime > 0,
|
|
158
|
+
maxRequests: this.opts.maxRequests,
|
|
159
|
+
debounceTime: this.opts.debounceTime
|
|
155
160
|
});
|
|
156
161
|
|
|
157
162
|
// Maps tile id in string {z}-{x}-{y} to a Tile object
|
|
@@ -168,8 +173,6 @@ export class Tileset2D {
|
|
|
168
173
|
|
|
169
174
|
this._modelMatrix = new Matrix4();
|
|
170
175
|
this._modelMatrixInverse = new Matrix4();
|
|
171
|
-
|
|
172
|
-
this.setOptions(opts);
|
|
173
176
|
}
|
|
174
177
|
|
|
175
178
|
/* Public API */
|