我在里面有 mapbox-gl-js v2.14.1 的 html 页面,并使用此代码成功生成了圆半径。
map.addLayer({
'id': 'point',
'type': 'circle',
'source': 'point',
'paint': {
'circle-radius': [
'interpolate',
['linear'],
['zoom'],
8, 5,
18, 250
],
'circle-color': $('header').css("background-color"),
'circle-opacity': 0.5,
'circle-stroke-color': $('header').css("background-color"),
'circle-stroke-width': 1
}
});
它就像一个魅力,圆圈大小尊重缩放事件。如何让圆大小半径在500米以内?
我试过这段代码,但是不行,没有控制台日志错误。它在地图上只显示很小的圆圈,放大时圆圈大小不变。
map.addLayer({
'id': 'point',
'type': 'circle',
'source': 'point',
'paint': {
'circle-radius': [
'interpolate',
['exponential', 2],
['zoom'],
0, 0,
20, [
'/',
['*', 500, 0.075],
['cos', ['*', ['get', 'lat'], ['/', Math.PI, 180]]],
],
],
'circle-color': $('header').css("background-color"),
'circle-opacity': 0.5,
'circle-stroke-color': $('header').css("background-color"),
'circle-stroke-width': 1
}
});