From 96c52a6d58e10f3fae2a69ab00ed219e9f2d0059 Mon Sep 17 00:00:00 2001 From: JeremyJamesL Date: Wed, 4 Dec 2024 09:09:11 +0000 Subject: first commit --- src/main.js | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 src/main.js (limited to 'src/main.js') 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(); -- cgit v1.2.3