leaflet-plugins
Version:
Miscellaneous plugins for Leaflet library for services that need to display route information and need satellite imagery from different providers
29 lines (25 loc) • 814 B
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="../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 = L.map('map', {center: L.latLng(58.4, 43.0), zoom: 11});
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png').addTo(map);
var track = new L.GPX('speed.gpx', {
async: true
}).on('loaded', function (e) {
map.fitBounds(e.target.getBounds());
}).speedSplitEnable({
maxSpeed: 100,
chunks: 1000
}).addTo(map);
L.control.layers({}, {'GPX':track}).addTo(map);
</script>
</body>
</html>