2011-02-26 01:01:29 +08:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<title>Leaflet debug page</title>
|
|
|
|
|
2011-04-08 19:53:34 +08:00
|
|
|
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
|
2011-02-27 08:08:09 +08:00
|
|
|
|
2011-04-08 19:53:34 +08:00
|
|
|
<link rel="stylesheet" href="../../dist/leaflet.css" />
|
2013-03-22 22:27:07 +08:00
|
|
|
|
2011-04-08 19:53:34 +08:00
|
|
|
<link rel="stylesheet" href="../css/mobile.css" />
|
2013-03-22 22:27:07 +08:00
|
|
|
|
2011-06-02 22:07:56 +08:00
|
|
|
<script src="../leaflet-include.js"></script>
|
2011-02-26 01:01:29 +08:00
|
|
|
</head>
|
|
|
|
<body>
|
2011-04-08 19:53:34 +08:00
|
|
|
<div id="map"></div>
|
2011-02-26 01:01:29 +08:00
|
|
|
|
2011-02-26 22:34:51 +08:00
|
|
|
<script src="route.js"></script>
|
|
|
|
<script>
|
2014-03-04 23:54:41 +08:00
|
|
|
var osmUrl = 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
|
|
|
|
osmAttrib = '© <a href="http://openstreetmap.org/copyright">OpenStreetMap</a> contributors',
|
|
|
|
osm = L.tileLayer(osmUrl, {maxZoom: 18, attribution: osmAttrib});
|
2013-03-22 22:27:07 +08:00
|
|
|
|
2011-02-26 22:34:51 +08:00
|
|
|
for (var i = 0, latlngs = [], len = route.length; i < len; i++) {
|
2011-02-26 01:01:29 +08:00
|
|
|
latlngs.push(new L.LatLng(route[i][0], route[i][1]));
|
|
|
|
}
|
2011-04-08 19:53:34 +08:00
|
|
|
var path = new L.Polyline(latlngs, {smoothFactor: 1});
|
2011-02-26 22:34:51 +08:00
|
|
|
|
2014-03-04 23:54:41 +08:00
|
|
|
var map = new L.Map('map', {layers: [osm]});
|
2011-02-26 22:34:51 +08:00
|
|
|
|
|
|
|
map.fitBounds(new L.LatLngBounds(latlngs));
|
2013-03-22 22:27:07 +08:00
|
|
|
|
2011-02-26 22:34:51 +08:00
|
|
|
map.addLayer(new L.Marker(latlngs[0]));
|
2011-04-08 19:53:34 +08:00
|
|
|
map.addLayer(new L.Marker(latlngs[latlngs.length - 1]));
|
2013-03-22 22:27:07 +08:00
|
|
|
|
2011-02-26 01:01:29 +08:00
|
|
|
map.addLayer(path);
|
|
|
|
</script>
|
|
|
|
</body>
|
2013-03-22 22:27:07 +08:00
|
|
|
</html>
|