Add prehistoric sites

This commit is contained in:
2024-12-02 16:48:40 +01:00
parent 5dd1f3c77d
commit c16c2763e0
4 changed files with 61 additions and 0 deletions

View File

@@ -135,12 +135,14 @@ GIS.initMap = async function (mapId, zoomLevel = this.INIT_ZOOM) {
let markersGroup = await this.sitesMarkers(sitesGroup);
let notConservedGroup = await this.notConserved();
let findingsGroup = await this.findings();
let prehistoric = await this.prehistoric();
const archeo = {
'Beni archeologici (punti)' : markersGroup,
'Beni archeologici (strutture)' : sitesGroup,
'Beni non conservati' : notConservedGroup,
'Rinvenimenti' : findingsGroup,
'Siti preistorici' : prehistoric,
'Vincoli archeologici' : layerVincoli,
'Vincoli paesistici' : layerPaesistici,
};
@@ -151,6 +153,7 @@ GIS.initMap = async function (mapId, zoomLevel = this.INIT_ZOOM) {
sitesGroup.addTo(map);
notConservedGroup.addTo(map);
findingsGroup.addTo(map);
prehistoric.addTo(map);
L.control.layers(baseMap, archeo).addTo(map);
@@ -249,6 +252,36 @@ GIS.findings = async function () {
return findings;
}
/**
* Create group for prehistoric sites
*
*/
GIS.prehistoric = async function () {
const geo = await fetch(`${BASE_URL}/geojson/preistorici.geojson`)
.then(res => res.json());
let prehistoric = L.markerClusterGroup(
clusterOptions
);
L.geoJSON(geo, {
pointToLayer: function(geoJsonPoint, latlng) {
prehistoric.addLayer(
L.marker(latlng, {
icon: Icons.prehistoric
}).bindTooltip(geoJsonPoint.properties.denominazione)
.bindPopup(`
<table class="table is-striped is-size-6 m-2">
<tr><th>Denominazione:</th><td>${geoJsonPoint.properties.denominazione}</td></tr>
<tr><th>Oggetto:</th><td>${geoJsonPoint.properties.oggetto}</td></tr>
</table>
`)
);
},
});
return prehistoric;
}
/*
GIS._prepareLayers = async function(layer) {
const fromStorage = localStorage.getItem(layer.id);

View File

@@ -30,6 +30,15 @@ Icons.finding = L.icon(
}
);
Icons.prehistoric = L.icon(
{
iconUrl: 'img/icons/preistorici.png',
iconSize: [18, 27],
iconAnchor: [10, 24],
tooltipAnchor: [0, -22],
}
);
Icons.camera = L.divIcon({className: 'fa fa-camera'});
export default Icons;