Skip to content

Instantly share code, notes, and snippets.

@tamlt2704
Created February 9, 2018 12:32
Show Gist options
  • Save tamlt2704/e18c9e3da6701f72361d57279aac0f50 to your computer and use it in GitHub Desktop.
Save tamlt2704/e18c9e3da6701f72361d57279aac0f50 to your computer and use it in GitHub Desktop.
<html>
<head>
<title>Leaflet</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" type="image/x-icon" href="docs/images/favicon.ico" />
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css" />
<script src="https://unpkg.com/[email protected]/dist/leaflet.js"></script>
</head>
<body>
<div id="mapid" style="width: 100%; height: 800px;"></div>
<script>
var map = L.map('mapid').setView([1.290270, 103.851959], 12);
L.tileLayer('https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw', {
id: 'mapbox.streets'
}).addTo(map);
var pointList = [
new L.LatLng(1.3706069539499999, 103.892668089),
new L.LatLng(1.37016500003, 103.89536),
];
var route2 = [
new L.LatLng(1.3706069539499999, 103.892668089),
new L.LatLng(1.37016500003, 103.89536),
new L.LatLng(1.37239666925, 103.897773625),
new L.LatLng(1.37514056376, 103.897248119)
];
var firstpolyline = new L.Polyline(pointList, {
color: 'red',
weight: 3,
opacity: 0.5,
smoothFactor: 3
});
firstpolyline.addTo(map);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment