1let leafletMap = null; 2function loadMap(mapdiv, locations, lat, ln) { 3 ('Location-->', locations); 4 const defaultLat = 19.3910038; 5 const defaultLng = -99.2836969; 6 if (leafletMap ){ 7 leafletMap.eachLayer(function(layer){ 8 layer.remove(); 9 }); 10 leafletMap.remove(); 11 leafletMap = null; 12 } 13 leafletMap = L.map(mapdiv).setView([lat ? lat : defaultLat, ln ? ln: defaultLng], 17); 14 L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { 15 attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors' 16 }).addTo(leafletMap); 17 if(locations) { 18 let markers = L.markerClusterGroup(); 19 console.log("Localiza # "+locations.length) 20 for (let i = 0; i < locations.length; i++) { 21 let lat = locations[i][1] ? locations[i][1] : defaultLat; 22 let lng = locations[i][2] ? locations[i][2] : defaultLng; 23 let marker = L.marker([lat, lng]) 24 .bindPopup(locations[i][0]) 25 .openPopup(); 26 markers.addLayer(marker); 27 } 28 leafletMap.addLayer(markers); 29 leafletMap.fitBounds(markers.getBounds()); 30 } 31}
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.