2017-07-19 297 views
-1

我是新來的谷歌地圖API我不知道如何在谷歌地圖上創建虛線的圓圈。我曾嘗試使用下面的代碼使用JavaScript在谷歌地圖上繪製虛線圓圈

circle = new google.maps.Circle({ 
strokeColor: Settings.CircleRadius.strokeColor, 
strokeOpacity: Settings.CircleRadius.strokeOpacity, 
strokeWeight: Settings.CircleRadius.strokeWeight, 
fillColor: #0000FF, 
fillOpacity: Settings.CircleRadius.fillOpacity, 
center: click_latlon, 
map: map, 
//clickable: true, 
radius: radius_m //Radius in meters 
}); 

有人可以幫助我如何畫虛線圓圈上的谷歌地圖創建了谷歌地圖的圓。

+0

[例如小提琴(http://jsfiddle.net/geocodezip/33prhsjp/1/) – geocodezip

回答

0

這裏是虛線折線的代碼,你可以有一個圓圈類似的東西一試

// Define a symbol using SVG path notation, with an opacity of 1. 
    var lineSymbol = { 
     path: 'M 0,-1 0,1', 
     strokeOpacity: 1, 
     scale: 4 
    }; 

    // Create the polyline, passing the symbol in the 'icons' property. 
    // Give the line an opacity of 0. 
    // Repeat the symbol at intervals of 20 pixels to create the dashed effect. 
    var line = new google.maps.Polyline({ 
     path: [{lat: 22.291, lng: 153.027}, {lat: 18.291, lng: 153.027}], 
     strokeOpacity: 0, 
     icons: [{ 
     icon: lineSymbol, 
     offset: '0', 
     repeat: '20px' 
     }], 
     map: map 
    });