-
Notifications
You must be signed in to change notification settings - Fork 820
/
index.js
Latest commit
38 lines (34 loc) · 966 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
33
34
35
36
37
38
/**
* @license
* Copyright 2019 Google LLC. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
// [START maps_add_map]
// Initialize and add the map
letmap;
asyncfunctioninitMap(){
// [START maps_add_map_instantiate_map]
// The location of Uluru
constposition={lat:-25.344,lng:131.031};
// Request needed libraries.
//@ts-ignore
const{Map}=awaitgoogle.maps.importLibrary("maps");
const{AdvancedMarkerElement}=awaitgoogle.maps.importLibrary("marker");
// The map, centered at Uluru
map=newMap(document.getElementById("map"),{
zoom:4,
center:position,
mapId:"DEMO_MAP_ID",
});
// [END maps_add_map_instantiate_map]
// [START maps_add_map_instantiate_marker]
// The marker, positioned at Uluru
constmarker=newAdvancedMarkerElement({
map:map,
position:position,
title:"Uluru",
});
// [END maps_add_map_instantiate_marker]
}
initMap();
// [END maps_add_map]