$(document).ready(function() {
$('select').material_select();
var mapChangeCommunity = function (event) {
var communityid = event.layer.feature.properties.community_id
location.href = 'firmware.php?id=' + communityid
}
var map = L.map('map').setView([50.75600670286445, 7.170810699462891], 9.5)
L.tileLayer('https://cartodb-basemaps-{s}.global.ssl.fastly.net/{style}/{z}/{x}/{y}.png', {
attribution: 'Map data © OpenStreetMap-Mitwirkende, CC-BY-SA, Imagery © Carto',
maxZoom: 18,
style: 'light_all'
}).addTo(map);
communityiesGeoJson.forEach(function (i) {
$.getJSON( i.geojson, function( data ) {
var community = L.geoJSON(data, {
style: {
fillColor: data.features[0].properties.color,
fillOpacity: 0.25,
color: data.features[0].properties.color,
opacity: 1,
weight: 2
}
}).addTo(map)
community.on('click', mapChangeCommunity);
community.bindPopup(i.name)
community.on('mouseover', function (e) {
this.openPopup();
});
community.on('mouseout', function (e) {
this.closePopup();
});
})
})
});