aboutsummaryrefslogtreecommitdiff
path: root/src/main.js
diff options
context:
space:
mode:
authorJeremyJamesL <jeremyluscombe@gmail.com>2024-12-04 09:09:11 +0000
committerJeremyJamesL <jeremyluscombe@gmail.com>2024-12-04 09:09:11 +0000
commit96c52a6d58e10f3fae2a69ab00ed219e9f2d0059 (patch)
treef4d519dfd4ee0ab38e7d875b05edb671c71b0fa9 /src/main.js
first commit
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();