-
Notifications
You must be signed in to change notification settings - Fork 71
Expand file tree
/
Copy pathmain.js
More file actions
49 lines (40 loc) · 1.33 KB
/
main.js
File metadata and controls
49 lines (40 loc) · 1.33 KB
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
40
41
42
43
44
45
46
47
48
49
// Initialize and add the map
let map;
async function initMap() {
// Create an array of Indian Coffee House locations
const indianCoffeeHouses = [
{ lat: 10.152691403374137, lng: 76.73782588446456, name: "Indian Coffee House 1" },
{ lat: 10.18062367564776, lng: 76.4350655114152, name: "Indian Coffee House 2" },
{ lat: 9.950490304914442, lng: 76.63755310505263, name: "Indian Coffee House 3" },
{ lat: 10.032395545432703, lng: 76.36337757752591, name: "Indian Coffee House 4" },
];
// Request needed libraries.
//@ts-ignore
const { Map } = await google.maps.importLibrary("maps");
const { AdvancedMarkerElement } = await google.maps.importLibrary("marker");
// Define a map style for dark mode
const darkModeStyle = [
{
featureType: "all",
elementType: "labels.text.fill",
stylers: [{ color: "#ffffff" }],
},
// Add more style configurations as needed.
];
// The map, centered at Uluru
map = new Map(document.getElementById("map"), {
zoom: 4,
center: position,
mapId: "DEMO_MAP_ID",
styles: darkModeStyle,
});
// Add markers for Indian Coffee Houses
indianCoffeeHouses.forEach(place => {
new AdvancedMarkerElement({
map: map,
position: place,
title: place.name,
});
});
}
initMap();