@deck.gl/geo-layers 9.2.11 → 9.3.0-alpha.2

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.2.11",
6
+ "version": "9.3.0-alpha.2",
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.3.4",
42
- "@loaders.gl/gis": "~4.3.4",
43
- "@loaders.gl/loader-utils": "~4.3.4",
44
- "@loaders.gl/mvt": "~4.3.4",
45
- "@loaders.gl/schema": "~4.3.4",
46
- "@loaders.gl/terrain": "~4.3.4",
47
- "@loaders.gl/tiles": "~4.3.4",
48
- "@loaders.gl/wms": "~4.3.4",
49
- "@luma.gl/gltf": "~9.2.6",
50
- "@luma.gl/shadertools": "~9.2.6",
41
+ "@loaders.gl/3d-tiles": "^4.4.0-alpha.18",
42
+ "@loaders.gl/gis": "^4.4.0-alpha.18",
43
+ "@loaders.gl/loader-utils": "^4.4.0-alpha.18",
44
+ "@loaders.gl/mvt": "^4.4.0-alpha.18",
45
+ "@loaders.gl/schema": "^4.4.0-alpha.18",
46
+ "@loaders.gl/terrain": "^4.4.0-alpha.18",
47
+ "@loaders.gl/tiles": "^4.4.0-alpha.18",
48
+ "@loaders.gl/wms": "^4.4.0-alpha.18",
49
+ "@luma.gl/gltf": "^9.3.0-alpha.6",
50
+ "@luma.gl/shadertools": "^9.3.0-alpha.6",
51
51
  "@math.gl/core": "^4.1.0",
52
52
  "@math.gl/culling": "^4.1.0",
53
53
  "@math.gl/web-mercator": "^4.1.0",
@@ -61,9 +61,9 @@
61
61
  "@deck.gl/extensions": "~9.2.0",
62
62
  "@deck.gl/layers": "~9.2.0",
63
63
  "@deck.gl/mesh-layers": "~9.2.0",
64
- "@loaders.gl/core": "~4.3.4",
65
- "@luma.gl/core": "~9.2.6",
66
- "@luma.gl/engine": "~9.2.6"
64
+ "@loaders.gl/core": "^4.4.0-alpha.18",
65
+ "@luma.gl/core": "~9.3.0-alpha.6",
66
+ "@luma.gl/engine": "~9.3.0-alpha.6"
67
67
  },
68
- "gitHead": "35adca6c8646a5125517cbccb99ce1b733b02235"
68
+ "gitHead": "135d329f4a4b596ae2c16e4eb801eda30252f3bc"
69
69
  }
@@ -98,7 +98,7 @@ function getLayerRange(
98
98
  const layerNames: Record<string, LayerRange> = {};
99
99
  const {properties} = geomData;
100
100
  for (let i = 0; i < properties.length; i++) {
101
- const {layerName: key} = properties[i] as Record<string, any>;
101
+ const {layerName: key} = properties[i];
102
102
  if (!key) {
103
103
  // ignore
104
104
  } else if (layerNames[key]) {
@@ -176,25 +176,31 @@ export default class Tile3DLayer<DataT = any, ExtraPropsT extends {} = {}> exten
176
176
  }
177
177
 
178
178
  private async _loadTileset(tilesetUrl) {
179
- const {loadOptions = {}} = this.props;
179
+ const loadOptions = this.props.loadOptions || {};
180
180
 
181
181
  // TODO: deprecate `loader` in v9.0
182
182
  // @ts-ignore
183
- const loaders = this.props.loader || this.props.loaders;
183
+ const loaders = this.props.loaders?.length ? this.props.loaders : this.props.loader;
184
184
  const loader = Array.isArray(loaders) ? loaders[0] : loaders;
185
185
 
186
- const options = {loadOptions: {...loadOptions}};
186
+ // Extract tileset-specific options so they are passed to the Tileset3D constructor
187
+ const {tileset: tilesetOptions, ...remainingLoadOptions} = loadOptions;
188
+
189
+ const options = {loadOptions: {...remainingLoadOptions}, ...tilesetOptions};
187
190
  let actualTilesetUrl = tilesetUrl;
188
- if (loader.preload) {
191
+ if ('preload' in loader && typeof loader.preload === 'function') {
189
192
  const preloadOptions = await loader.preload(tilesetUrl, loadOptions);
190
193
  if (preloadOptions.url) {
191
194
  actualTilesetUrl = preloadOptions.url;
192
195
  }
193
196
 
194
197
  if (preloadOptions.headers) {
195
- options.loadOptions.fetch = {
196
- ...options.loadOptions.fetch,
197
- headers: preloadOptions.headers
198
+ options.loadOptions.core = {
199
+ ...options.loadOptions.core,
200
+ fetch: {
201
+ ...options.loadOptions.core?.fetch,
202
+ headers: preloadOptions.headers
203
+ }
198
204
  };
199
205
  }
200
206
  Object.assign(options, preloadOptions);
@@ -205,6 +211,7 @@ export default class Tile3DLayer<DataT = any, ExtraPropsT extends {} = {}> exten
205
211
  onTileLoad: this._onTileLoad.bind(this),
206
212
  onTileUnload: this._onTileUnload.bind(this),
207
213
  onTileError: this.props.onTileError,
214
+ onUpdate: () => this.setNeedsUpdate(),
208
215
  ...options
209
216
  });
210
217
 
@@ -219,6 +226,9 @@ export default class Tile3DLayer<DataT = any, ExtraPropsT extends {} = {}> exten
219
226
 
220
227
  private _onTileLoad(tileHeader: Tile3D): void {
221
228
  const {lastUpdatedViewports} = this.state;
229
+ // Mark as not yet drawn so transition hold keeps previous tiles
230
+ // visible until this tile's sublayer renders for the first time
231
+ tileHeader.tileDrawn = false;
222
232
  this.props.onTileLoad(tileHeader);
223
233
  this._updateTileset(lastUpdatedViewports);
224
234
  this.setNeedsUpdate();
@@ -337,7 +347,10 @@ export default class Tile3DLayer<DataT = any, ExtraPropsT extends {} = {}> exten
337
347
  modelMatrix,
338
348
  getTransformMatrix: instance => instance.modelMatrix,
339
349
  getPosition: [0, 0, 0],
340
- _offset: 0
350
+ _offset: 0,
351
+ onFirstDraw: () => {
352
+ tileHeader.tileDrawn = true;
353
+ }
341
354
  }
342
355
  );
343
356
  }
@@ -21,8 +21,8 @@ import {
21
21
  } from '@deck.gl/core';
22
22
  import {BitmapLayer} from '@deck.gl/layers';
23
23
  import type {GetImageParameters, ImageSourceMetadata, ImageType} from '@loaders.gl/loader-utils';
24
- import type {ImageServiceType} from '@loaders.gl/wms';
25
- import {ImageSource, createImageSource} from '@loaders.gl/wms';
24
+ import {createDataSource} from '@loaders.gl/core';
25
+ import {ImageSource, WMSSource} from '@loaders.gl/wms';
26
26
  import {WGS84ToPseudoMercator} from './utils';
27
27
 
28
28
  /** All props supported by the TileLayer */
@@ -31,7 +31,7 @@ export type WMSLayerProps = CompositeLayerProps & _WMSLayerProps;
31
31
  /** Props added by the TileLayer */
32
32
  type _WMSLayerProps = {
33
33
  data: string | ImageSource;
34
- serviceType?: ImageServiceType | 'auto';
34
+ serviceType?: 'wms' | 'auto';
35
35
  layers?: string[];
36
36
  srs?: 'EPSG:4326' | 'EPSG:3857' | 'auto';
37
37
  onMetadataLoad?: (metadata: ImageSourceMetadata) => void;
@@ -166,11 +166,12 @@ export class WMSLayer<ExtraPropsT extends {} = {}> extends CompositeLayer<
166
166
  }
167
167
 
168
168
  if (typeof props.data === 'string') {
169
- return createImageSource({
170
- url: props.data,
171
- loadOptions: props.loadOptions,
172
- type: props.serviceType
173
- });
169
+ return createDataSource(props.data, [WMSSource], {
170
+ core: {
171
+ type: props.serviceType,
172
+ loadOptions: props.loadOptions
173
+ }
174
+ }) as ImageSource;
174
175
  }
175
176
 
176
177
  throw new Error('invalid image source in props.data');