@deck.gl/geo-layers 9.0.0-beta.7 → 9.0.0-beta.9

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/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-beta.7",
6
+ "version": "9.0.0-beta.9",
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.1.0",
42
- "@loaders.gl/gis": "^4.1.0",
43
- "@loaders.gl/loader-utils": "^4.1.0",
44
- "@loaders.gl/mvt": "^4.1.0",
45
- "@loaders.gl/schema": "^4.1.0",
46
- "@loaders.gl/terrain": "^4.1.0",
47
- "@loaders.gl/tiles": "^4.1.0",
48
- "@loaders.gl/wms": "^4.1.0",
49
- "@luma.gl/gltf": "9.0.0-beta.8",
50
- "@luma.gl/shadertools": "9.0.0-beta.8",
41
+ "@loaders.gl/3d-tiles": "^4.2.0-alpha.5",
42
+ "@loaders.gl/gis": "^4.2.0-alpha.5",
43
+ "@loaders.gl/loader-utils": "^4.2.0-alpha.5",
44
+ "@loaders.gl/mvt": "^4.2.0-alpha.5",
45
+ "@loaders.gl/schema": "^4.2.0-alpha.5",
46
+ "@loaders.gl/terrain": "^4.2.0-alpha.5",
47
+ "@loaders.gl/tiles": "^4.2.0-alpha.5",
48
+ "@loaders.gl/wms": "^4.2.0-alpha.5",
49
+ "@luma.gl/gltf": "^9.0.0",
50
+ "@luma.gl/shadertools": "^9.0.0",
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",
@@ -60,9 +60,9 @@
60
60
  "@deck.gl/extensions": "^9.0.0-beta",
61
61
  "@deck.gl/layers": "^9.0.0-beta",
62
62
  "@deck.gl/mesh-layers": "^9.0.0-beta",
63
- "@loaders.gl/core": "^4.1.0",
64
- "@luma.gl/core": "9.0.0-beta.8",
65
- "@luma.gl/engine": "9.0.0-beta.8"
63
+ "@loaders.gl/core": "^4.2.0-alpha.5",
64
+ "@luma.gl/core": "^9.0.0",
65
+ "@luma.gl/engine": "^9.0.0"
66
66
  },
67
- "gitHead": "1676f8d6f7534259996bf58a7b7e1fba6f3af9ae"
67
+ "gitHead": "44cfc784310d1c6ac7766ff80e0df8c364f97354"
68
68
  }
@@ -63,12 +63,14 @@ export type TileJson = {
63
63
  type ParsedMvtTile = Feature[] | BinaryFeatureCollection;
64
64
 
65
65
  /** All props supported by the MVTLayer */
66
- export type MVTLayerProps = _MVTLayerProps &
67
- Omit<GeoJsonLayerProps, 'data'> &
66
+ export type MVTLayerProps<FeaturePropertiesT = unknown> = _MVTLayerProps<FeaturePropertiesT> &
68
67
  Omit<TileLayerProps<ParsedMvtTile>, 'data'>;
69
68
 
70
69
  /** Props added by the MVTLayer */
71
- export type _MVTLayerProps = {
70
+ export type _MVTLayerProps<FeaturePropertiesT> = Omit<
71
+ GeoJsonLayerProps<FeaturePropertiesT>,
72
+ 'data'
73
+ > & {
72
74
  data: TileJson | URLTemplate;
73
75
 
74
76
  /** Called if `data` is a TileJSON URL when it is successfully fetched. */
@@ -98,10 +100,10 @@ export type _MVTLayerProps = {
98
100
  type ContentWGS84Cache = {_contentWGS84?: Feature[]};
99
101
 
100
102
  /** Render data formatted as [Mapbox Vector Tiles](https://docs.mapbox.com/vector-tiles/specification/). */
101
- export default class MVTLayer<ExtraProps extends {} = {}> extends TileLayer<
102
- ParsedMvtTile,
103
- Required<_MVTLayerProps> & ExtraProps
104
- > {
103
+ export default class MVTLayer<
104
+ FeaturePropertiesT = any,
105
+ ExtraProps extends {} = {}
106
+ > extends TileLayer<ParsedMvtTile, Required<_MVTLayerProps<FeaturePropertiesT>> & ExtraProps> {
105
107
  static layerName = 'MVTLayer';
106
108
  static defaultProps = defaultProps;
107
109
 
@@ -114,12 +116,6 @@ export default class MVTLayer<ExtraProps extends {} = {}> extends TileLayer<
114
116
  hoveredFeatureLayerName: string | null;
115
117
  };
116
118
 
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
119
  initializeState(): void {
124
120
  super.initializeState();
125
121
  // GlobeView doesn't work well with binary data
@@ -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
  *
@@ -221,6 +229,7 @@ export default class TileLayer<DataT = any, ExtraPropsT extends {} = {}> extends
221
229
  maxZoom,
222
230
  minZoom,
223
231
  maxRequests,
232
+ debounceTime,
224
233
  zoomOffset
225
234
  } = this.props;
226
235
 
@@ -233,6 +242,7 @@ export default class TileLayer<DataT = any, ExtraPropsT extends {} = {}> extends
233
242
  refinementStrategy,
234
243
  extent,
235
244
  maxRequests,
245
+ debounceTime,
236
246
  zoomOffset,
237
247
 
238
248
  getTileData: this.getTileData.bind(this),
@@ -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
- maxRequests: opts.maxRequests,
154
- throttleRequests: Boolean(opts.maxRequests && opts.maxRequests > 0)
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 */