Skip to content

Instantly share code, notes, and snippets.

@Synesso
Created July 2, 2019 11:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Synesso/188f9747f1af37e90c93a02a917246ec to your computer and use it in GitHub Desktop.
Save Synesso/188f9747f1af37e90c93a02a917246ec to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<title>Simple Leaflet Map</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.5.1/dist/leaflet.css"
integrity="sha512-xwE/Az9zrjBIphAcBb3F6JVqxf46+CDLwfLMHloNu6KEQCAWi6HcDUbeOfBIptF7tcCzusKFjFw2yuvEpDL9wQ=="
crossorigin=""/>
<script src="https://unpkg.com/leaflet@1.5.1/dist/leaflet.js"
integrity="sha512-GffPMF3RvMeYyc1LWMHtK8EbPv0iNZ8/oTtHPx9/cc2ILxQ+u905qIwdpULaqDkyBKgOaB57QTMg7ztg8Jm2Og=="
crossorigin=""></script>
</head>
<body>
<div id="mapid" style="width: 800px; height: 640px"></div>
<script>
var map = L.map('mapid').setView([40, 0], 2);
// You can get better tiles if you sign up for mapbox API key.
// Or maybe there's some better free ones.
mapLink =
'<a href="http://openstreetmap.org">OpenStreetMap</a>';
L.tileLayer(
'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '&copy; ' + mapLink + ' Contributors',
maxZoom: 18,
}).addTo(map);
var polyline = L.polyline([
[52.370216,4.895168],
[45.523064,-122.676483],
[38.627003,-90.199402],
[14.616199, 121.059319],
[34.152588, 77.577049],
[30.332184, -81.655647],
[47.606209, -122.332069],
[47.603230, -122.330280],
[33.608768,-117.873360],
],
{
color: 'red',
weight: 4,
opacity: .7,
lineJoin: 'round'
}
).addTo(map);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment