aboutsummaryrefslogtreecommitdiff
path: root/src/main.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.js')
-rw-r--r--src/main.js39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/main.js b/src/main.js
new file mode 100644
index 0000000..91d53e5
--- /dev/null
+++ b/src/main.js
@@ -0,0 +1,39 @@
+const MAPS_KEY = "AIzaSyCtS6CiOrG95FhroSUdDJJokItndcMkrgc";
+
+// Initialize and add the map
+let map;
+
+async function initMap() {
+ // The location of Uluru
+ const position = { lat: 51.508616, lng: -0.125319 };
+ // Request needed libraries.
+
+ //@ts-ignore
+ const { Map } = await google.maps.importLibrary("maps");
+ const { AdvancedMarkerElement } = await google.maps.importLibrary("marker");
+
+ // The map, centered at Uluru
+ map = new Map(document.getElementById("map"), {
+ zoom: 7,
+ center: position,
+ mapId: "DEMO_MAP_ID",
+ restriction: {
+ latLngBounds: {
+ north: 51.74,
+ south: 51.27,
+ west: -0.51,
+ east: 0.23,
+ },
+ // strictBounds: true,
+ },
+ });
+
+ // The marker, positioned at Uluru
+ const marker = new AdvancedMarkerElement({
+ map: map,
+ position: position,
+ title: "Uluru",
+ });
+}
+
+initMap();