1
votes

When should one use a marker instead of a feature layer of points in Mapbox?

Points layers can be updated and styled dynamically using all the styling tools of Mapbox GL JS. Features in points layers can also be clicked, presenting a popup just like with a marker.

Given this, when would one want to use a marker?

1
If you want to animate your marker, better accessibilityAndrewHarvey

1 Answers

1
votes

As Andrew mentioned there are two sides two this:

  1. Accessibility

Markers are implemented as DOM elements and thus can be included in the tab order and can be given accessibility attributes

  1. Animation

As markers are DOM elements animating them is quite easy with a bit of CSS & JS. You can animate points on a circle layer too, but its much more of a hassle.

  1. Small point count

The number of markers/points you can display at once is somewhat limited by what the DOM can manage. My suggestion is that, if you have more than 500 points to display, you should opt for a circle layer instead of markers (this is a very rough estimates and depends on other parameters as well, animation, point size etc.). Using a circle layer you will hit - depending on the hardware - a limit in the 10s of thounds of points.