ffrs-fw-dl/js/comunitychoose.js

36 lines
1.5 KiB
JavaScript
Raw Permalink Normal View History

2017-06-04 10:26:25 +00:00
$(document).ready(function() {
$('select').material_select();
var mapChangeCommunity = function (event) {
var communityid = event.layer.feature.properties.community_id
2017-06-26 13:42:51 +00:00
location.href = 'subauswahl.php?id=' + communityid
2017-06-04 10:26:25 +00:00
}
2017-06-18 14:00:09 +00:00
var map = L.map('map').setView([50.75600670286445, 7.390810699462891], 9.5)
2017-06-04 10:26:25 +00:00
2018-12-24 00:33:21 +00:00
L.tileLayer('https://{s}.basemaps.cartocdn.com/{style}/{z}/{x}/{y}.png', {
2017-06-04 10:26:25 +00:00
attribution: 'Map data &copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap-Mitwirkende</a>, <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Imagery © <a href="https://carto.com/location-data-services/basemaps">Carto</a>',
maxZoom: 18,
style: 'light_all'
}).addTo(map);
communityiesGeoJson.forEach(function (i) {
$.getJSON( i.geojson, function( data ) {
var community = L.geoJSON(data, {
style: {
2017-06-05 08:39:04 +00:00
fillColor: data.features[0].properties.color,
2017-06-04 10:26:25 +00:00
fillOpacity: 0.25,
2017-06-05 08:39:04 +00:00
color: data.features[0].properties.color,
2017-06-04 10:26:25 +00:00
opacity: 1,
weight: 2
}
}).addTo(map)
community.on('click', mapChangeCommunity);
2017-06-04 21:36:58 +00:00
community.bindPopup(i.name)
community.on('mouseover', function (e) {
this.openPopup();
});
community.on('mouseout', function (e) {
this.closePopup();
});
2017-06-04 10:26:25 +00:00
})
})
2018-12-24 00:33:21 +00:00
});