Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions docs/api-reference/geo-layers/tile-layer.md
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,19 @@ Apps may define a custom `refinementStrategy` by supplying its own callback func

When called, the function receives an array of [Tile](#tile) instances representing every tile that is currently in the cache. It is an opportunity to manipulate `tile.isVisible` before sub layers are rendered. `isVisible` is initially set to the value of `isSelected` (equivalent to `refinementStrategy: 'never'`).

#### `lodStrategy` (string, optional) {#lodstrategy}

Controls whether the layer prefetches lower-resolution tiles to provide instant coverage during viewport transitions (panning, zooming, or camera flights).

* `'none'`: Only request tiles at the current zoom level. No additional lower-resolution coverage tiles are fetched.
* `'coverage'`: In addition to the current zoom tiles, prefetch ancestor tiles at progressively lower zoom levels. These low-resolution tiles load quickly and act as fallback coverage while higher-resolution tiles are still loading, reducing blank areas during navigation.

Use `'coverage'` when your application involves frequent camera movement (e.g. animated transitions, user exploration) and visual continuity matters more than minimizing network requests. Use `'none'` when bandwidth is constrained, tiles are expensive to fetch, or the viewport is mostly static.

Note: The `'coverage'` strategy is designed for geospatial views (e.g. `MapView`) where tiles follow a power-of-2 hierarchy. It is not recommended for non-geospatial views (e.g. `FirstPersonView`, `OrthographicView`) where viewport movement patterns differ and ancestor tiles may not provide meaningful coverage.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chrisgervang FirstPersonView seems it will need a different LoD implementation, but it should definitely be considered in this initiative. My long term goal is to get LoD parity with Spark2.0 as I work on SplatLayer - which has more FirstPersonView applications. Albeit, a different layer class...


- Default: `'none'`

#### `maxRequests` (number, optional) {#maxrequests}

The maximum number of concurrent `getTileData` calls.
Expand Down
2 changes: 2 additions & 0 deletions modules/geo-layers/src/terrain-layer/terrain-layer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,7 @@ export default class TerrainLayer<ExtraPropsT extends {} = {}> extends Composite
maxCacheSize,
maxCacheByteSize,
refinementStrategy,
lodStrategy,
zoomOffset
} = this.props;

Expand Down Expand Up @@ -391,6 +392,7 @@ export default class TerrainLayer<ExtraPropsT extends {} = {}> extends Composite
maxCacheSize,
maxCacheByteSize,
refinementStrategy,
lodStrategy,
zoomOffset
}
);
Expand Down
11 changes: 11 additions & 0 deletions modules/geo-layers/src/tile-layer/tile-layer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
Tileset2D,
Tile2DHeader,
RefinementStrategy,
LODStrategy,
STRATEGY_DEFAULT,
Tileset2DProps
} from '../tileset-2d/index';
Expand All @@ -47,6 +48,7 @@ const defaultProps: DefaultProps<TileLayerProps> = {
maxCacheSize: null,
maxCacheByteSize: null,
refinementStrategy: STRATEGY_DEFAULT,
lodStrategy: 'none',
zRange: null,
maxRequests: 6,
debounceTime: 0,
Expand Down Expand Up @@ -126,6 +128,13 @@ type _TileLayerProps<DataT> = {
*/
refinementStrategy?: RefinementStrategy;

/**
* How the tile layer prefetches lower resolution coverage for smooth transitions.
*
* @default 'none'
*/
lodStrategy?: LODStrategy;

/** Range of minimum and maximum heights in the tile. */
zRange?: ZRange | null;

Expand Down Expand Up @@ -261,6 +270,7 @@ export default class TileLayer<DataT = any, ExtraPropsT extends {} = {}> extends
maxCacheSize,
maxCacheByteSize,
refinementStrategy,
lodStrategy,
extent,
maxZoom,
minZoom,
Expand All @@ -278,6 +288,7 @@ export default class TileLayer<DataT = any, ExtraPropsT extends {} = {}> extends
minZoom,
tileSize,
refinementStrategy,
lodStrategy,
extent,
maxRequests,
debounceTime,
Expand Down
4 changes: 2 additions & 2 deletions modules/geo-layers/src/tileset-2d/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ export type {
TileBoundingBox
} from './types';

export type {Tileset2DProps, RefinementStrategy} from './tileset-2d';
export {Tileset2D, STRATEGY_DEFAULT} from './tileset-2d';
export type {Tileset2DProps, RefinementStrategy, LODStrategy} from './tileset-2d';
export {Tileset2D, STRATEGY_DEFAULT, LOD_STRATEGY_COVERAGE, LOD_STRATEGY_NONE} from './tileset-2d';

export {Tile2DHeader} from './tile-2d-header';

Expand Down
3 changes: 2 additions & 1 deletion modules/geo-layers/src/tileset-2d/tile-2d-header.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export class Tile2DHeader<DataT = any> {
index: TileIndex;
isVisible: boolean;
isSelected: boolean;
isPrefetch: boolean;
parent: Tile2DHeader | null;
children: Tile2DHeader[] | null;
content: DataT | null;
Expand All @@ -42,6 +43,7 @@ export class Tile2DHeader<DataT = any> {
this.index = index;
this.isVisible = false;
this.isSelected = false;
this.isPrefetch = false;
this.parent = null;
this.children = [];

Expand Down Expand Up @@ -118,7 +120,6 @@ export class Tile2DHeader<DataT = any> {
this._abortController = new AbortController();
const {signal} = this._abortController;

// @ts-expect-error (2345) loaders.gl's RequestScheduler callback type is too narrow.
const requestToken = await requestScheduler.scheduleRequest(this, getRequestPriority);

if (!requestToken) {
Expand Down
Loading
Loading