3
A
回答
12
Bing Maps V7不包含繪製圓圈方法。
圓圈必須通過繪製幾個小段來「近似」。土地在這裏
var key = .....; // API access key
var MM = Microsoft.Maps;
var R = 6371; // earth's mean radius in km
var map = new Microsoft.Maps.Map(this.element[0], {credentials: key, disableKeyboardInput: true});
var radius = ...; //radius of the circle
var latitude = ...; //latitude of the circle center
var longitude = ...; //longitude of the circle center
var backgroundColor = new Microsoft.Maps.Color(10, 100, 0, 0);
var borderColor = new Microsoft.Maps.Color(150, 200, 0, 0);
var lat = (latitude * Math.PI)/180;
var lon = (longitude * Math.PI)/180;
var d = parseFloat(radius)/R;
var circlePoints = new Array();
for (x = 0; x <= 360; x += 5) {
var p2 = new MM.Location(0, 0);
brng = x * Math.PI/180;
p2.latitude = Math.asin(Math.sin(lat) * Math.cos(d) + Math.cos(lat) * Math.sin(d) * Math.cos(brng));
p2.longitude = ((lon + Math.atan2(Math.sin(brng) * Math.sin(d) * Math.cos(lat),
Math.cos(d) - Math.sin(lat) * Math.sin(p2.latitude))) * 180)/Math.PI;
p2.latitude = (p2.latitude * 180)/Math.PI;
circlePoints.push(p2);
}
var polygon = new MM.Polygon(circlePoints, { fillColor: backgroundColor, strokeColor: borderColor, strokeThickness: 1 });
map.entities.push(polygon);
+0
太棒了!非常感謝。 – 2013-02-21 00:19:17
相關問題
- 1. 向地圖添加邊界半徑
- 2. Bing地圖中行車路線的圓圈半徑
- 3. 在Google地圖標記周圍添加圓/半徑
- 4. 如何向圓角圖像添加圓角邊框(使用邊框半徑圓角)
- 5. 向地圖視圖添加圓角
- 6. 如何在註解周圍添加圓作爲半徑
- 7. 如何將地圖劃分爲給定半徑的圓?
- 8. 如何計算谷歌地圖圓半徑JS把C#
- 9. 角谷歌地圖如何限制一個圓的半徑?
- 10. 如何根據縮放計算圓半徑谷歌地圖api
- 11. 如何使用Google地圖上的一次點擊添加一個圓並獲取圓的座標和半徑?
- 12. 增加圓環圖的內半徑,以及如何在圓環圖內寫入
- 13. 谷歌地圖圓形半徑適合地圖
- 14. 向TinyMCE textarea添加邊界半徑
- 15. 谷歌地圖方向半徑
- 16. Numpy:添加圓的半徑以形成直徑
- 17. Bing地圖SDK Win8.1 - 添加圖層
- 18. 在Bing地圖中添加圖釘
- 19. 特定圓半徑
- 20. 半徑公差圓
- 21. 向視圖添加圓角?
- 22. 向Google地圖添加路徑(API v3)
- 23. Highchart - 如何半圓餅圖
- 24. 在地圖視圖中繪製一定半徑的圓圈android
- 25. 如何倒轉添加邊框半徑?
- 26. 如何渲染半徑爲x的圓?
- 27. 如何更改UISegmentedControl的圓角半徑?
- 28. 如何繪製具有固定半徑的Google地圖圓形覆蓋圖?
- 29. 如何將圖像添加到信息框? - Bing地圖V8
- 30. 如何將wms圖層添加到使用javascript的bing地圖?
4人:冰MSDN論壇答案】(https://social.msdn.microsoft.com/Forums/en-US/bd041bbd-:Bing地圖V8圈的答案可以從這裏得到的b4be-40b6-ae68-8b48aba83b64/how-to-create-accuracy-circle-in-bing-map-v8?forum = bingmapsajax) – RyBolt 2016-08-08 14:25:33