// Mapy.CZ: const API_KEY = 'Uw8gm6JPZpnT3GfNnh8adARpQI-WBGy6QaY9g6VhD74'; var mapyCZ = L.tileLayer(`https://api.mapy.cz/v1/maptiles/basic/256/{z}/{x}/{y}?apikey=${API_KEY}`, { minZoom: 0, maxZoom: 19, attribution: '© Seznam.cz a.s. a další', }) /* We also require you to include our logo somewhere over the map. We create our own map control implementing a documented interface, that shows a clickable logo. See https://leafletjs.com/reference.html#control */ const LogoControl = L.Control.extend({ options: { position: 'bottomleft', }, onAdd: function (map) { const container = L.DomUtil.create('div'); const link = L.DomUtil.create('a', '', container); link.setAttribute('href', 'http://mapy.cz/'); link.setAttribute('target', '_blank'); link.innerHTML = ''; L.DomEvent.disableClickPropagation(link); return container; }, }); // OpenStreetMap: var osm = L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', { maxZoom: 19, attribution: '© OpenStreetMap' }) // Výchozí bod: var map = L.map('map', { center: [50.853501146, 14.8425], zoom: 16, layers: [mapyCZ, osm] }); // Rámeček s výběrem podkladů: var baseMaps = { "Mapy.cz": mapyCZ, "OpenStreetMap": osm }; var layerControl = L.control.layers(baseMaps).addTo(map); // finally we add our LogoControl to the map new LogoControl().addTo(map, { layers: [osm, mapyCZ] }); // futury: function onEachFeature(feature, layer) { // does this feature have a property named popupContent? if (feature.properties && feature.properties.number) { layer.bindPopup("Obvod č. "+feature.properties.number.toString()); } layer.on({ mouseover: highlightFeature, mouseout: resetHighlight, click: zoomToFeature }); } // futury - interakce: function style(feature) { return { fillColor: '#FD8D3C', weight: 2, opacity: 1, color: 'blue', dashArray: '3', fillOpacity: 0.05 }; } function highlightFeature(e) { var layer = e.target; layer.setStyle({ weight: 5, color: '#666', dashArray: '', fillOpacity: 0.2 }); layer.bringToFront(); } function resetHighlight(e) { geojson.resetStyle(e.target); } function zoomToFeature(e) { map.fitBounds(e.target.getBounds()); }