问题
I want to decrease the size of the markers when the zoom level of the map is increased. How can I achieve this?
回答1:
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
来源:https://stackoverflow.com/questions/61032600/scale-marker-size-relative-to-the-zoom-level-in-mapbox-gl-js