2013-02-26 85 views
0

如何在谷歌地圖上的某個位置(中心除外)畫一個圓圈,提供的用戶有緯度,經度和半徑?如何在谷歌地圖上畫圓圈

+3

首款谷歌的結果:http://blog.enbake.com/draw-circle-with-google-maps-api-v3/ – Johan 2013-02-26 22:06:42

回答

3
// Create marker 
var marker = new google.maps.Marker({ 
    map: map, 
    position: new google.maps.LatLng(53, -2.5), 
    title: 'Some location' 
}); 

// Add circle overlay and bind to marker 
var circle = new google.maps.Circle({ 
    map: map, 
    radius: 16093, // 10 miles in metres 
    fillColor: '#AA0000' 
}); 

circle.bindTo('center', marker, 'position'); 

聽起來像是如果你有緯度/長,你要那麼你可以定義一個點的地方在地圖上的半徑,然後綁定一個圓圈這一點。

Source