get map clicks and show the lat lng

This commit is contained in:
Eli Ribble 2026-03-05 17:58:31 +00:00
parent fdae11f7cd
commit 121b880783
No known key found for this signature in database
2 changed files with 28 additions and 8 deletions

View file

@ -37,7 +37,7 @@ class MapArcgisTile extends HTMLElement {
center: [longitude, latitude],
container: mapElement,
style: "https://tiles.stadiamaps.com/styles/osm_bright.json",
zoom: 22,
zoom: 20,
});
console.log("ArcGIS token", arcgis_access_token);
const basemap_style = maplibreArcGIS.BasemapStyle.applyStyle(this._map, {
@ -79,13 +79,29 @@ class MapArcgisTile extends HTMLElement {
});
console.log("added arcgis tile layer");
}
this.dispatchEvent(new CustomEvent("load"), {
bubbles: true,
composed: true, // Allows event to cross shadow DOM boundary
detail: {
map: this,
},
});
this.dispatchEvent(
new CustomEvent("load", {
bubbles: true,
composed: true, // Allows event to cross shadow DOM boundary
detail: {
map: this,
},
}),
);
});
this._map.on("click", (e) => {
this.dispatchEvent(
new CustomEvent("map-click", {
bubbles: true,
composed: true,
detail: {
lng: e.lngLat.lng,
lat: e.lngLat.lat,
map: this._map,
point: e.point,
},
}),
);
});
}