mapbox / mapbox/mapbox-gl-js

Allow adding sources, layers & setting terrain without waiting for map load

Open
#10,191 4 comments 4 reactions 1 assignee View on GitHub

@mourner is already working on this.

Since Dec 14, 2020.

api :memo: feature :green_apple: performance :zap:
Dominant language
TypeScript
Stars
12.4k
Forks
2.4k
PR merge metrics
No merged PRs in 30d

Description

One of the biggest hurdles when adding terrain to an existing style is that we need to wait for the map load event first, and only then we can add the terrain source and set the terrain options. This is problematic both ergonomically (it's annoying to use map.on('load', () => { ... } constantly in even basic examples), and in terms of performance, since terrain tiles don't start loading until all the vector tiles finished loading and rendering.

We should investigate whether it's possible to improve the style mechanism so that:

  • sources and layers could be added lazily, without waiting for load, so that their incorporation into the style would be deferred until it's loaded (if loading is in progress) instead of throwing and error
  • lazily loaded sources eagerly initialize the source cache and start loading tiles before the map has finished loading.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.