Allow adding sources, layers & setting terrain without waiting for map load
Open
@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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.