UNPKG

leaflet-plugins

Version:

Miscellaneous plugins for Leaflet library for services that need to display route information and need satellite imagery from different providers

28 lines (27 loc) 884 B
<html> <head> <title>Leaflet</title> <link rel="stylesheet" href="https://unpkg.com/leaflet@1.5.1/dist/leaflet.css" /> <script src="http://unpkg.com/leaflet@1.5.1/dist/leaflet.js"></script> <script src="../layer/vector/GPX.js"></script> <script src="../layer/vector/GPX.Speed.js"></script> </head> <body> <div style="width:100%; height:100%" id="map"></div> <script type='text/javascript'> var map = new L.Map('map', {center: new L.LatLng(58.4, 43.0), zoom: 11}); var osm = new L.TileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'); var track = new L.GPX("data/31_08_2019.gpx", { async: true }).on("loaded", function(e) { map.fitBounds(e.target.getBounds()); }).speedSplitEnable({ maxSpeed: 40, chunks: 562 }); map.addLayer(track); map.addLayer(osm); map.addControl(new L.Control.Layers({}, {'GPX':track})); </script> </body> </html>