xxxxxxxxxx
<html>
<head>
<meta charset=utf-8 />
<title>Leaflet Image</title>
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no' />
<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>
</head>
<body>
<script src='https://api.tiles.mapbox.com/mapbox.js/plugins/leaflet-image/v0.0.3/leaflet-image.js'></script>
<button id='snap' style='position: absolute; bottom: 10px; right: 10px;'>Snap image</button>
<div id='images' style='float: right; width: 49%;'></div>
<div id='map' style='width: 49%;'></div>
<script type="text/javascript">
var map = L.mapbox.map('map', 'skorasaurus.jvs1kg0c', {
center: [41.487556,-81.673393],
zoom: 13
});
document.getElementById('snap').addEventListener('click', function() {
leafletImage(map, doImage);
});
function doImage(err, canvas) {
var img = document.createElement('img');
img.width = 800;
img.height = 400;
img.src = canvas.toDataURL();
document.getElementById('images').innerHTML = '';
document.getElementById('images').appendChild(img);
}
</script>
</body>
</html>
https://api.tiles.mapbox.com/mapbox.js/v1.6.1/mapbox.js
https://api.tiles.mapbox.com/mapbox.js/plugins/leaflet-image/v0.0.3/leaflet-image.js