Created
November 12, 2015 12:43
-
-
Save Arty2/3a03457380817714e783 to your computer and use it in GitHub Desktop.
Strip bird's view tiles from Bing maps (requires tweaking the code)
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
<!DOCTYPE HTML> | |
<html> | |
<head> | |
</head> | |
<body> | |
<canvas id="canvas"></canvas> | |
<script> | |
var tile_w = 256; | |
var tile_h = 256; | |
var cols = 8; //16 | |
var rows = 6; //12 | |
var canvas = document.getElementById('canvas'); | |
canvas.width = tile_w * cols; | |
canvas.height = tile_h * rows; | |
var img = canvas.getContext('2d'); | |
var tiles = []; | |
for (var i = 0; i < cols * rows; i++) { | |
tiles[i] = new Image(); | |
//make self deployable at some point | |
tiles[i].src = 'http://ak.t0.tiles.virtualearth.net/tiles/o12210020330-2630-19-'+ i +'?g=2325'; | |
//console.log(typeof tile);http://ak.t0.tiles.virtualearth.net/tiles/o12210020330-2623-19-0?g=2325 | |
// | |
} | |
alert('wait for it to load...'); | |
var i = 0; | |
for (var r = 0; r < rows; r++) { | |
for (var c = 0; c < cols; c++) { | |
img.drawImage(tiles[i], c * tile_w, r * tile_h); | |
i++; | |
} | |
} | |
// save canvas image as data url (png format by default) | |
window.location = canvas.toDataURL(); | |
</script> | |
<noscript>enable javascript</noscript> | |
</body> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment