Scale marker size relative to the zoom level in Mapbox GL JS

↘锁芯ラ 提交于 2020-12-29 04:45:47

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!