Which way to put two data sources on the map has higher performance?
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 12.4k
- Forks
- 2.4k
- PR merge metrics
- No merged PRs in 30d
Description
"mapbox-gl": "^2.10.0"

Question
I came upon this question while developing an app which contains 2 symbol layers with two different layouts. I want to display places using one marker, and clusters using another one. The markers are too significantly different to use the same layer for both. Places and clusters are returned in the same API call. To do this we can choose two approaches...
- Using one source, set data to a polymorphic feature list, and add two layers pointing to the same source using filters to split which layer the features belong in.
- Using two sources and two layers.
If we use two sources does mapbox render twice? Do we lose performance? Does filtering lose more performance?
Links to related documentation
https://docs.mapbox.com/mapbox-gl-js/style-spec/sources/
https://docs.mapbox.com/mapbox-gl-js/style-spec/layers/
https://docs.mapbox.com/help/glossary/symbol-layer/
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 with the linked Mapbox GL JS source and layer style-spec documentation, then investigate how the two approaches are rendered and filtered. Done means adding documentation that clearly compares one source with filtered layers against two sources and layers, including any relevant performance guidance.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- documentation, performance
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100