![](/img/trans.png)
[英]How can I find all the coordinates in a Mapbox Draw circle using center and radius?
[英]How to draw the circle in the mapbox
我已經搜索了如何使用 Javascript 在地圖框中繪制圓圈,但找不到正確的解決方案。
var myCircle = new MapboxCircle({lat: data.lat, lng: data.lng}, data.radius, {
editable: true,
minRadius: data.minRadius,
fillColor: data.color
}).addTo(map);
上面的代碼由 Mapbox 提供,但它只允許在地圖上以固定半徑添加圓形圖層。
但我想要的是通過拖動以動態半徑繪制圓。
您可以使用最新版本的 Leaflet 以米為單位傳遞這些半徑。 半徑將相對於縮放級別而變化。
以下是Leaflet 文檔中的更多信息
L.circle([lat,lng], radius).addTo(map);
更多文檔在這里: https : //www.mapbox.com/mapbox.js/api/v2.1.9/l-circlemarker/
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.