2016-06-17 4 views
0

Styled Map Wizardを使用して、マップのスタイルにJSONを設定しています。しかし、私どものクライアントは自転車や歩道を散策したいと思っています。私は道を点線にする方法を見つけることができないようです。それは可能ですか?Googleマップのテーマスタイリング

答えて

1

はい、それは次のようになります。

Dashed lines

あなたが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 
}); 

希望はこれが

を支援します