Seleziona un Comune

Clicca sulla cartografia.


Qualità dell’acqua

Dati in preparazione.

PSA

Sezione prevista per sviluppi futuri.

document.addEventListener(“DOMContentLoaded”, function () {

var map = L.map(‘ra-map’);

L.tileLayer(
‘https://tile.openstreetmap.org/{z}/{x}/{y}.png’,
{
attribution: ‘© OpenStreetMap’
}
).addTo(map);

let layerComuni;

fetch(
“http://rivieracqua.it/wp-content/uploads/2026/10/Comuni_Imperia.geojson.txt”
)
.then(r => r.json())
.then(data => {

function style() {

return {
fillColor: “#4DA6D9”,
weight: 1,
opacity: 1,
color: “#ffffff”,
fillOpacity: 0.65
};
}

function evidenzia(e) {

e.target.setStyle({
weight: 3,
color: “#005B96”,
fillOpacity: 0.9
});
}

function reset(e) {

layerComuni.resetStyle(
e.target
);
}

function clickComune(e) {

const p =
e.target.feature.properties;

document
.getElementById(
“comuneTitle”
)
.innerHTML =
p.nome_comun || “Comune”;

document
.getElementById(
“ra-comune”
)
.innerHTML =
“Comune: ”
+ (p.nome_comun || “-“);

document
.getElementById(
“ra-analisi”
)
.innerHTML =
“Area predisposta per le analisi dell’acqua.”;
}

function onEachFeature(
feature,
layer
) {

layer.bindTooltip(
feature.properties.nome_comun || “Comune”,
{
sticky:true
}
);

layer.on({
mouseover:evidenzia,
mouseout:reset,
click:clickComune
});

}

layerComuni = L.geoJSON(data,{

style:style,

onEachFeature:onEachFeature

}).addTo(map);

map.fitBounds(
layerComuni.getBounds()
);

});

});