Created
January 23, 2014 16:56
-
-
Save jamesnesfield/8582325 to your computer and use it in GitHub Desktop.
annotateEdinburgh
This file contains hidden or 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
<script src='https://api.tiles.mapbox.com/mapbox.js/v1.6.1/mapbox.js'></script> | |
<link href='https://api.tiles.mapbox.com/mapbox.js/v1.6.1/mapbox.css' rel='stylesheet' /> | |
<style> | |
body { margin:0; padding:0; } | |
#map { position:absolute; top:0; bottom:0; width:100%; } | |
</style> | |
<body> | |
<div id='map'></div> | |
</body> |
This file contains hidden or 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
var map = L.mapbox.map('map', 'examples.map-9ijuk24y') | |
.setView([55.8, -3], 8); | |
var line_options = { | |
color: '#fff', // Stroke color | |
opacity: 1, // Stroke opacity | |
weight: 1, // Stroke weight | |
fillColor: '#000', // Fill color | |
fillOpacity: 0.6 // Fill opacity | |
}; | |
// add a new line to the map, but one with no points - yet | |
// keep a tally of how many points we've added to the map | |
var pointsAdded = 0; | |
// start adding new points to the map | |
add(); | |
function add() { | |
var polyline = L.polyline([ | |
[55.5+Math.random(), | |
-3+Math.random()], | |
[55.5+Math.random(), | |
-3+Math.random()] | |
],line_options).addTo(map); | |
if (++pointsAdded < 100) window.setTimeout(add, 100); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment