mapbox / mapbox/mapbox-gl-js

Which way to put two data sources on the map has higher performance?

Open
#12,374 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

auto-triaged docs :scroll:
Dominant language
TypeScript
Stars
12.4k
Forks
2.4k
PR merge metrics
No merged PRs in 30d

Description

"mapbox-gl": "^2.10.0"

localhost_4000_app(iPhone SE)

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...

  1. 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.
  2. 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

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.

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.