Map#setLayerSource to allow changing a layer's source
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 12.4k
- Forks
- 2.4k
- PR merge metrics
- No merged PRs in 30d
Description
This would let you change a layer's source. Currently you need to
- getLayer (due to #3713 you need to getStyle then find the layer)
- removeLayer
- addLayer
This would make it easier to to use local GeoJSON sources on the client side together with layers from Mapbox Studio. In Studio you can't create local GeoJSON source layers so you need to use a dummy source, which requires swapping out on the client side.
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.
Research direction
Start at the Map#setLayerSource entry point and compare the existing getLayer/getStyle, removeLayer, and addLayer flow described in the issue. Determine how a layer can switch from a Studio dummy source to a client-side GeoJSON source without that sequence. Done means the public Map API supports changing the layer source while preserving the layer, with coverage for the described use case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api, frontend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100