lrm-ign-geoservices
Version:
Support for Ign Geoservices in Leaflet Routing Machine
57 lines (48 loc) • 1.77 kB
HTML
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, user-scalable=no" />
<meta name="author" content="Thomas Muguet" />
<title>L.Routing.IgnGeoservices</title>
<link rel="stylesheet" href="node_modules/leaflet/dist/leaflet.css" />
<link
rel="stylesheet"
href="node_modules/leaflet-routing-machine/dist/leaflet-routing-machine.css"
/>
<script src="node_modules/leaflet/dist/leaflet.js"></script>
<script src="node_modules/leaflet-routing-machine/dist/leaflet-routing-machine.min.js"></script>
<script src="node_modules/@mapbox/corslite/corslite.js"></script>
<script src="dist/lrm-ign-geoservices.js"></script>
</head>
<body>
<div
id="map"
style="position: absolute; top:0px; left: 0px; bottom: 0px; right: 0px;"
></div>
<script>
window.onload = function() {
var map = L.map('map', {
center: L.latLng(44.96777356135154, 6.06822967529297),
zoom: 13
});
var osmUrl = 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png';
var osmAttrib =
'Map data © <a href="https://openstreetmap.org">OpenStreetMap</a> contributors';
var osm = new L.TileLayer(osmUrl, { attribution: osmAttrib });
map.addLayer(osm);
L.Routing.control({
waypoints: [
L.latLng(44.98815855417898, 6.079473495483399),
L.latLng(44.974012776218, 6.069173812866211)
],
routeWhileDragging: true,
router: L.Routing.ignGeoservices({
profile: 'pedestrian'
})
}).addTo(map);
};
</script>
</body>
</html>