1/* *********************************************************** 2 *** Modul Map (openstreetmap) 3 ********************************************************** */ 4 5var map = null; 6$(document).ready(function () { 7 8 if ($('#openstreetmap-container').length) { 9 //console.log('init openstreetmap-container'); 10 var zoom = $('#openstreetmap-zoom').val(); 11 //var markerText = $('#openstreetmap-marker-text').val(); 12 let locations = []; 13 $('.openstreetmap-data').each(function () { 14 let label = $(this).find('#openstreetmap-label').val(); 15 let lat = $(this).find('#openstreetmap-latitude').val(); 16 let lon = $(this).find('#openstreetmap-longitude').val(); 17 locations.push([label, lat, lon]); 18 }); 19 20 map = L.map('openstreetmap-container', { 21 center: [0, 0], 22 zoom: zoom, 23 dragging: true, 24 scrollWheelZoom: false 25 }); 26 27 // Finde die maximalen und minimalen Werte der Breiten- und Längengrade 28 var minLat = Number.POSITIVE_INFINITY; 29 var maxLat = Number.NEGATIVE_INFINITY; 30 var minLon = Number.POSITIVE_INFINITY; 31 var maxLon = Number.NEGATIVE_INFINITY; 32 for (var i = 0; i < locations.length; i++) { 33 var lat = parseFloat(locations[i][1]); 34 var lon = parseFloat(locations[i][2]); 35 36 if (lat < minLat) minLat = lat; 37 if (lat > maxLat) maxLat = lat; 38 if (lon < minLon) minLon = lon; 39 if (lon > maxLon) maxLon = lon; 40 } 41 42 // Berechne den Durchschnitt der maximalen und minimalen Werte, um die Zentrierung festzulegen 43 var centerLat = (minLat + maxLat) / 2; 44 var centerLon = (minLon + maxLon) / 2; 45 46 // Setze die Karte auf die berechneten Durchschnittskoordinaten
47 map.setView([centerLat, centerLon], zoom); 48 49 /*L.tileLayer('https://maps.imahosting.de?z={z}&x={x}&y={y}&r=cartodb-basemaps', { 50 detectRetina: true, 51 crossOrigin: true 52 }).addTo(map);*/ 53 54 L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { 55 attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors', 56 detectRetina: true, 57 crossOrigin: true 58 }).addTo(map); 59 60 61 for (var i = 0; i < locations.length; i++) { 62 marker = new L.marker([locations[i][1], locations[i][2]]) 63 .bindPopup(locations[i][0]) 64 .addTo(map); 65 } 66 67 } 68});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.