I want to decrease the size of the markers when the zoom level of the map is increased. How can I achieve this?
Asked
Active
Viewed 8,248 times
1 Answers
19
You can use the interpolate
expression with the zoom
expression, along these lines:
"icon-size": ['interpolate', ['linear'], ['zoom'], 10, 1, 15, 0.5]
Documentation here: https://docs.mapbox.com/mapbox-gl-js/style-spec/expressions/#ramps-scales-curves

Steve Bennett
- 114,604
- 39
- 168
- 219
-
3how do you implement that in a mapboxgl.Marker()? – n00b Sep 12 '20 at 22:12
-
That would be completely different. Feel free to ask that question. – Steve Bennett Sep 13 '20 at 02:54
-
1Here you go: https://stackoverflow.com/questions/63870324/how-to-implement-mapbox-expression-inside-marker – n00b Sep 13 '20 at 11:42
-
Does GMaps support a similar feature as Mapbox? – Olsi Saqe Aug 26 '21 at 16:01