-
Notifications
You must be signed in to change notification settings - Fork 821
/
index.js
39 lines (38 loc) · 1.1 KB
/
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
33
34
35
36
37
38
39
/**
* @license
* Copyright 2019 Google LLC. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
// [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]
}
window.initMap = initMap;
// [END maps_overlay_symbol_arrow]