diff --git a/js/caprigis.js b/js/caprigis.js index ae28b08..8722b81 100644 --- a/js/caprigis.js +++ b/js/caprigis.js @@ -87,6 +87,15 @@ GIS.initMap = async function (mapId, zoomLevel = this.INIT_ZOOM) { ) .addTo(map); + sitesGroup.eachLayer(layer => { + const marker = L.marker(layer.getBounds().getCenter()) + .addTo(map); + marker.on('click', async () => { + const data = await GIS._fetchData(layer.id); + UI.openModal(data); + }); + }); + // TODO Horrible? return {map: map, sites: sitesGroup}; } @@ -144,7 +153,7 @@ GIS.loadLayer = async function (geoJSON, options, popup = true) { // Show data from feature in popUp? const layer = new L.geoJson(data, { - style: function (feature) { + style: function () { let style = options; return style; }, diff --git a/js/ui.js b/js/ui.js index 17dbfd3..4729cd1 100644 --- a/js/ui.js +++ b/js/ui.js @@ -76,6 +76,8 @@ UI.openModal = async function (data) {