-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathindex.js
More file actions
31 lines (31 loc) · 933 Bytes
/
index.js
File metadata and controls
31 lines (31 loc) · 933 Bytes
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
/**
* @license
* Copyright 2026 Google LLC. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
// [START maps_js_api_loader_map]
// [START maps_js_api_loader_map_load]
// Import the needed libraries.
import { setOptions, importLibrary } from '@googlemaps/js-api-loader';
// [END maps_js_api_loader_map_load]
const API_KEY = 'AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8';
async function initMap() {
// [START maps_js_api_loader_map_options]
// Set loader options.
setOptions({
key: API_KEY,
v: 'weekly',
});
// [END maps_js_api_loader_map_options]
// Load the Maps library.
const { Map } = (await importLibrary('maps'));
// Set map options.
const mapOptions = {
center: { lat: 48.8566, lng: 2.3522 },
zoom: 3,
};
// Declare the map.
const map = new Map(document.getElementById('map'), mapOptions);
}
initMap();
// [END maps_js_api_loader_map]