Add underwater sites
This commit is contained in:
@@ -120,6 +120,7 @@ GIS.initMap = async function (mapId, zoomLevel = this.INIT_ZOOM) {
|
||||
this.notConserved().then(group => {group.addTo(map); window.NotConserved = group});
|
||||
this.findings().then(group => {group.addTo(map); window.Findings = group});
|
||||
this.prehistoric().then(group => {group.addTo(map); window.Prehistoric = group});
|
||||
this.underwater().then(group => {group.addTo(map); window.Underwater = group});
|
||||
|
||||
const archeo = {
|
||||
'Vincoli archeologici' : layerVincoli,
|
||||
@@ -237,6 +238,30 @@ GIS.prehistoric = async function () {
|
||||
|
||||
return prehistoric;
|
||||
}
|
||||
/**
|
||||
* Create underwater sites group
|
||||
* @returns {L.MarkerClusterGroup}
|
||||
*/
|
||||
GIS.underwater = async function () {
|
||||
let underwaterData = await fetch(`${API_URL}/underwater`)
|
||||
.then(data => data.json());
|
||||
|
||||
let underwater = L.markerClusterGroup(clusterOptions);
|
||||
|
||||
for (let record of underwaterData.records) {
|
||||
underwater.addLayer(L.marker(
|
||||
record.coordinates,
|
||||
{icon: Icons.underwater}
|
||||
).bindTooltip(record.denomination)
|
||||
.on(
|
||||
'click',
|
||||
() => UI.openUnderwaterModal(record, '#underwater-data')
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
return underwater;
|
||||
}
|
||||
/**
|
||||
* Adds layers to map and returns an object
|
||||
* with {baseMap, archeoLayers, sitesLayerGroup}
|
||||
|
||||
Reference in New Issue
Block a user