diff --git a/.gitignore b/.gitignore index f0bf563..6dce625 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ *.log *.zip *.pdf +*.tif vendor/ progetto_QGIS/ conf.json diff --git a/webgis/index.html b/webgis/index.html index 8eb2c23..640a5ff 100644 --- a/webgis/index.html +++ b/webgis/index.html @@ -3,6 +3,8 @@ + + @@ -17,6 +19,7 @@ } + WebGIS Isola di Capri diff --git a/webgis/js/components/Finding.js b/webgis/js/components/Finding.js index e749ca2..fb6e601 100644 --- a/webgis/js/components/Finding.js +++ b/webgis/js/components/Finding.js @@ -96,7 +96,7 @@ export class Finding { this.biblioElements.push(`
-

${biblio.reference}

+

${biblio.reference}

`); }); diff --git a/webgis/js/components/NotConservedSheet.js b/webgis/js/components/NotConservedSheet.js index 1954dd9..74715f4 100644 --- a/webgis/js/components/NotConservedSheet.js +++ b/webgis/js/components/NotConservedSheet.js @@ -66,7 +66,7 @@ export class NotConservedSheet { this.biblioElements.push(`
-

${record.reference}

+

${record.reference}

` ); diff --git a/webgis/js/components/SiteSheet.js b/webgis/js/components/SiteSheet.js index 38160e1..e98e92a 100644 --- a/webgis/js/components/SiteSheet.js +++ b/webgis/js/components/SiteSheet.js @@ -106,7 +106,7 @@ export class SiteSheet { this.biblioElements.push(`
-

${record.reference}

+

${record.reference}

` ); diff --git a/webgis/js/controllers/marker_controller.js b/webgis/js/controllers/marker_controller.js index 4510c93..c8dc5cf 100644 --- a/webgis/js/controllers/marker_controller.js +++ b/webgis/js/controllers/marker_controller.js @@ -2,6 +2,7 @@ import { Controller } from "@hotwired/stimulus" export default class extends Controller { static targets = ['coords']; + END_ZOOM = 20; mapAnimate = { animate: true, duration: 1, @@ -14,7 +15,7 @@ export default class extends Controller { map.setView( coords, - 19, + this.END_ZOOM, this.mapAnimate ); diff --git a/webgis/js/gis.js b/webgis/js/gis.js index 8a09774..85cfd6e 100644 --- a/webgis/js/gis.js +++ b/webgis/js/gis.js @@ -160,10 +160,10 @@ GIS.initMap = async function (mapId, zoomLevel = this.INIT_ZOOM) { /** * Create markers for sites * @param {L.LayerGroup} sitesGroup - * @returns {L.LayerGroup} + * @returns {L.markerClusterGroup} */ GIS.sitesMarkers = async function (sitesGroup) { - let sitesMarkers = []; + let sitesMarkers = L.markerClusterGroup(); for (let id in MARKER_NAMES.sites) { let layer = sitesGroup.customGetLayer(id); @@ -191,23 +191,23 @@ GIS.sitesMarkers = async function (sitesGroup) { marker.on('click', () => UI.openSiteModal(data, '#site-data')); - sitesMarkers.push(marker); + sitesMarkers.addLayer(marker); } - return L.layerGroup(sitesMarkers); + return sitesMarkers; } /** * Create not conserved group - * @returns {L.LayerGroup} + * @returns {L.MarkerClusterGroup} */ GIS.notConserved = async function () { let notConserData = await fetch(`${API_URL}/not_conserved`) .then(data => data.json()); - let notConserved = []; + let notConserved = L.markerClusterGroup(); for (let record of notConserData.records) { - notConserved.push(L.marker( + notConserved.addLayer(L.marker( record.coordinates, {icon: Icons.notConserved} ).bindTooltip(record.denomination) @@ -218,20 +218,20 @@ GIS.notConserved = async function () { ); } - return L.layerGroup(notConserved); + return notConserved; } /** * Create findings group - * @returns {L.LayerGroup} + * @returns {L.MarkerClusterGroup} */ GIS.findings = async function () { let findingsData = await fetch(`${API_URL}/finding`) .then(data => data.json()); - let findings = []; + let findings = L.markerClusterGroup(); for (let record of findingsData) { - findings.push(L.marker( + findings.addLayer(L.marker( record.coordinates, {icon: Icons.finding} ).bindTooltip(record.object) @@ -242,7 +242,7 @@ GIS.findings = async function () { ); } - return L.layerGroup(findings); + return findings; } /* GIS._prepareLayers = async function(layer) { diff --git a/webgis/js/package.json b/webgis/js/package.json index 9f109db..48bf6e4 100644 --- a/webgis/js/package.json +++ b/webgis/js/package.json @@ -11,6 +11,7 @@ "bulma": "^1.0.1", "fontawesome-free": "^1.0.4", "leaflet": "^1.9.4", + "leaflet.markercluster": "^1.5.3", "spotlight.js": "^0.7.8" }, "devDependencies": {} diff --git a/webgis/js/yarn.lock b/webgis/js/yarn.lock index 7969d2e..2bd0266 100644 --- a/webgis/js/yarn.lock +++ b/webgis/js/yarn.lock @@ -29,6 +29,11 @@ fontawesome-free@^1.0.4: resolved "https://registry.yarnpkg.com/fontawesome-free/-/fontawesome-free-1.0.4.tgz#c7c499708dabd59eb5dedf232b590a862e05957b" integrity sha512-7sX6Lbg2oQiClFFFFitJlKg20h3YTBON6rdmq3uGjNwDo8G6EjF2bfj2OjjcCUmf4OvZCgyHaXfW2JseqissLw== +leaflet.markercluster@^1.5.3: + version "1.5.3" + resolved "https://registry.yarnpkg.com/leaflet.markercluster/-/leaflet.markercluster-1.5.3.tgz#9cdb52a4eab92671832e1ef9899669e80efc4056" + integrity sha512-vPTw/Bndq7eQHjLBVlWpnGeLa3t+3zGiuM7fJwCkiMFq+nmRuG3RI3f7f4N4TDX7T4NpbAXpR2+NTRSEGfCSeA== + leaflet@^1.9.4: version "1.9.4" resolved "https://registry.yarnpkg.com/leaflet/-/leaflet-1.9.4.tgz#23fae724e282fa25745aff82ca4d394748db7d8d"