Initial commit
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
function initBaseLayers(map) {
|
||||
var baseMap = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
||||
attribution: '© OpenStreetMap', maxZoom: 19
|
||||
});
|
||||
var baseSat = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {
|
||||
attribution: '© Esri', maxZoom: 19
|
||||
});
|
||||
baseMap.addTo(map);
|
||||
|
||||
document.getElementById('base-map').addEventListener('click', function() {
|
||||
if (map.hasLayer(baseSat)) map.removeLayer(baseSat);
|
||||
if (!map.hasLayer(baseMap)) baseMap.addTo(map);
|
||||
this.classList.add('active');
|
||||
document.getElementById('base-sat').classList.remove('active');
|
||||
});
|
||||
document.getElementById('base-sat').addEventListener('click', function() {
|
||||
if (map.hasLayer(baseMap)) map.removeLayer(baseMap);
|
||||
if (!map.hasLayer(baseSat)) baseSat.addTo(map);
|
||||
this.classList.add('active');
|
||||
document.getElementById('base-map').classList.remove('active');
|
||||
});
|
||||
}
|
||||
|
||||
function makeSpbuIcon(color, size) {
|
||||
size = size || 18;
|
||||
var h = size / 2;
|
||||
return L.divIcon({
|
||||
className: '',
|
||||
html: '<div style="width:'+size+'px;height:'+size+'px;border-radius:50%;background:'+color+';border:2px solid #fff;box-shadow:0 1px 4px rgba(0,0,0,.35);"></div>',
|
||||
iconSize: [size, size], iconAnchor: [h, h], popupAnchor: [0, -12]
|
||||
});
|
||||
}
|
||||
|
||||
function showToast(msg) {
|
||||
var el = document.getElementById('toast');
|
||||
if (!el) return;
|
||||
el.textContent = msg;
|
||||
el.classList.add('show');
|
||||
setTimeout(function() { el.classList.remove('show'); }, 3000);
|
||||
}
|
||||
Reference in New Issue
Block a user