• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

visgl / loaders.gl / 24283398526

11 Apr 2026 01:24PM UTC coverage: 55.094% (-0.08%) from 55.17%
24283398526

push

github

web-flow
 feat(tiles) Add Tiles3DSource and I3SSource (#3365)

8881 of 17385 branches covered (51.08%)

Branch coverage included in aggregate %.

401 of 602 new or added lines in 11 files covered. (66.61%)

1 existing line in 1 file now uncovered.

18531 of 32370 relevant lines covered (57.25%)

5152.09 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/modules/deck-layers/src/data-driven-tile-3d-source-layer.ts
1
// loaders.gl
2
// SPDX-License-Identifier: MIT
3
// Copyright (c) vis.gl contributors
4

5
import {DataDrivenTile3DLayer} from '@deck.gl-community/experimental';
6
import {Tileset3D, type Tileset3DProps} from '@loaders.gl/tiles';
7
import type {LoaderOptions, LoaderWithParser} from '@loaders.gl/loader-utils';
8
import {createSource} from './tile-3d-source-layer';
9

10
/**
11
 * `DataDrivenTile3DLayer` adapter that constructs source-backed `Tileset3D` instances.
12
 */
13
export class SourceDataDrivenTile3DLayer<
14
  DataT = any,
15
  ExtraProps extends Record<string, unknown> = Record<string, unknown>
16
> extends DataDrivenTile3DLayer<DataT, ExtraProps> {
17
  /** Install source-backed loading hooks after the base layer initializes its state. */
18
  initializeState(): void {
NEW
19
    super.initializeState();
×
NEW
20
    (this as any)._loadTileset = this.loadSourceTileset.bind(this);
×
21
  }
22

23
  /**
24
   * Loads a tileset using explicit source construction.
25
   * @param tilesetUrl Root tileset metadata URL.
26
   */
27
  private async loadSourceTileset(tilesetUrl: string): Promise<void> {
NEW
28
    const {loadOptions = {}} = this.props;
×
29

30
    // TODO: deprecate `loader` in v9.0
31
    // @ts-ignore
NEW
32
    const loaders = this.props.loader || this.props.loaders;
×
NEW
33
    const loader = (Array.isArray(loaders) ? loaders[0] : loaders) as LoaderWithParser;
×
34

NEW
35
    const options: {loadOptions: LoaderOptions} & Partial<Tileset3DProps> = {
×
36
      loadOptions: {...loadOptions}
37
    };
NEW
38
    let actualTilesetUrl = tilesetUrl;
×
39

NEW
40
    if (loader.preload) {
×
NEW
41
      const preloadOptions = await loader.preload(tilesetUrl, loadOptions);
×
NEW
42
      if (preloadOptions.url) {
×
NEW
43
        actualTilesetUrl = preloadOptions.url;
×
44
      }
45

NEW
46
      if (preloadOptions.headers) {
×
NEW
47
        options.loadOptions.fetch = {
×
48
          ...options.loadOptions.fetch,
49
          headers: preloadOptions.headers
50
        };
51
      }
NEW
52
      Object.assign(options, preloadOptions);
×
53
    }
54

NEW
55
    const source = createSource(actualTilesetUrl, loader, options.loadOptions);
×
NEW
56
    const tileset3d = new Tileset3D(source, {
×
57
      onTileLoad: (this as any)._onTileLoad.bind(this),
58
      onTileUnload: (this as any)._onTileUnload.bind(this),
59
      onTileError: this.props.onTileError,
60
      onTraversalComplete: (this as any)._onTraversalComplete.bind(this),
61
      ...options
62
    });
63

NEW
64
    this.setState({
×
65
      tileset3d,
66
      layerMap: {}
67
    });
68

NEW
69
    await tileset3d.tilesetInitializationPromise;
×
NEW
70
    (this as any)._updateTileset(this.state.activeViewports);
×
NEW
71
    this.props.onTilesetLoad?.(tileset3d);
×
72
  }
73
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc