-
Notifications
You must be signed in to change notification settings - Fork 821
/
index.js
executable file
·32 lines (32 loc) · 993 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// [START maps_overlay_symbol_arrow]
// This example adds a predefined symbol (an arrow) to a polyline.
// Setting offset to 100% places the arrow at the end of the line.
function initMap() {
const map = new google.maps.Map(document.getElementById("map"), {
zoom: 6,
center: { lat: 20.291, lng: 153.027 },
mapTypeId: "terrain",
});
// [START maps_overlay_symbol_arrow_region_polyline]
// Define a symbol using a predefined path (an arrow)
// supplied by the Google Maps JavaScript API.
const lineSymbol = {
path: google.maps.SymbolPath.FORWARD_CLOSED_ARROW,
};
// Create the polyline and add the symbol via the 'icons' property.
const line = new google.maps.Polyline({
path: [
{ lat: 22.291, lng: 153.027 },
{ lat: 18.291, lng: 153.027 },
],
icons: [
{
icon: lineSymbol,
offset: "100%",
},
],
map: map,
});
// [END maps_overlay_symbol_arrow_region_polyline]
}
// [END maps_overlay_symbol_arrow]