Last active
August 29, 2015 14:26
-
-
Save louh/908ab19728d36e3feb21 to your computer and use it in GitHub Desktop.
Minimum viable implementation of LRM-Valhalla
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Simple Valhalla-backed Leaflet Routing Machine</title> | |
<link rel='stylesheet' href='//cdn.leafletjs.com/leaflet-0.7.3/leaflet.css'> | |
<link rel='stylesheet' href='./node_modules/lrm-valhalla/examples/leaflet.routing.valhalla.css'> | |
<script src='//cdn.leafletjs.com/leaflet-0.7.3/leaflet.js'></script> | |
<script src='./node_modules/leaflet-routing-machine/dist/leaflet-routing-machine.js'></script> | |
<script src='./node_modules/lrm-valhalla/dist/lrm-valhalla.js'></script> | |
<style> | |
#map { | |
position: absolute; | |
top: 0; | |
left: 0; | |
width: 100%; | |
height: 100%; | |
} | |
</style> | |
</head> | |
<body> | |
<div id='map'></div> | |
<script> | |
var map = L.map('map'); | |
L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png').addTo(map); | |
L.Routing.control({ | |
waypoints: [ | |
L.latLng(19.325, -99.079), | |
L.latLng(19.485, -99.193) | |
], | |
router: L.Routing.valhalla('valhalla-ycfG8AM', 'auto'), | |
formatter: new L.Routing.Valhalla.Formatter(), | |
summaryTemplate:'<div class="start">{name}</div><div class="info {transitmode}">{distance}, {time}</div>', | |
routeWhileDragging: true | |
}).addTo(map); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment