leaflet-plugins
Version:
Miscellaneous plugins for Leaflet library for services that need to display route information and need satellite imagery from different providers
35 lines (31 loc) • 1.49 kB
HTML
<html>
<head>
<title>Leaflet</title>
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.5.1/dist/leaflet.css" />
<script src="https://unpkg.com/leaflet@1.5.1/dist/leaflet.js"></script>
<script src="../control/Permalink.js"></script>
<script src="../control/Permalink.Marker.js"></script>
<script src="../control/Permalink.Layer.js"></script>
<script src="../control/Permalink.Overlay.js"></script>
</head>
<body>
<div style="width:100%; height:100%" id="map"></div>
<script type='text/javascript'>
var map = L.map('map', {center: L.latLng(47.93, -3.44), zoom: 7});
var osm = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png');
var appid = '9de243494c0b295cca9337e1e96b00e2'; // demo id
var pressure = L.tileLayer('https://{s}.tile.openweathermap.org/map/pressure_cntr/{z}/{x}/{y}.png?appid='+appid, {
maxZoom: 19,
attribution: 'Map data © <a href="https://openweathermap.org">OpenWeatherMap</a>',
opacity: 0.5
});
var hydda = L.tileLayer('https://{s}.tile.openstreetmap.se/hydda/full/{z}/{x}/{y}.png', {
attribution: 'Tiles courtesy of <a href="https://openstreetmap.se/" target="_blank">OpenStreetMap Sweden</a> — Map data © <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>'
});
var layers = L.control.layers({'OSM':osm, 'Hydda':hydda},{'Pressure':pressure});
map.addLayer(osm);
map.addControl(layers);
map.addControl(new L.Control.Permalink({text: 'Permalink', layers: layers}));
</script>
</body>
</html>