Skip to content

Instantly share code, notes, and snippets.

@jamesnesfield
Created January 23, 2014 16:56
Show Gist options
  • Save jamesnesfield/8582325 to your computer and use it in GitHub Desktop.
Save jamesnesfield/8582325 to your computer and use it in GitHub Desktop.
annotateEdinburgh
<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>
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