2014-01-22 144 views
-1

我有以下经纬度数组,我可以在地图上绘制成功。我的问题是,如何获得一个循环,并为每个数组坐标放置一个具有自定义Km半径(或标准半径,如果它在4ss中太痛苦)的圆。谷歌地图上所有标记的绘图圈API v3

var locations = [ 
['lala', 37.0093833333333,24.7528638888889, 1], 
['lala', 35.0093833333333,20.7528638888889, 2] 
]; 

谢谢

+0

是的,你可以。你有什么尝试? [circle](https://developers.google.com/maps/documentation/javascript/shapes#circles) – geocodezip

+0

[在Google地图中围绕点绘制半径]的可能重复(http://stackoverflow.com/questions/825794 /抽取半径围绕-A-点功能于谷歌地图) – geocodezip

回答

2
var cityCircle  
for (elements in your array) { 
    var populationOptions = { 
     strokeColor: '#FF0000', 
     strokeOpacity: 0.8, 
     strokeWeight: 2, 
     fillColor: '#FF0000', 
     fillOpacity: 0.35, 
     map: map, 
     center: your latlng, 
     radius: your radius here 
    }; 
    // Add the circle for this city to the map. 
    cityCircle = new google.maps.Circle(populationOptions); 
    } 

这样的事情?