Created
January 22, 2012 19:17
-
-
Save cwholt/1658356 to your computer and use it in GitHub Desktop.
gmap hax
This file contains 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
<html> | |
<head> | |
<title>sup</title> | |
<script src='https://ajax.googleapis.com/ajax/libs/jquery/1.6.3/jquery.min.js' type='text/javascript'></script> | |
<script type="text/javascript"> | |
var zoom = 14; | |
var startX = 5207; | |
var startY = 7350; | |
var right = 16; | |
var down = 6; | |
function gMapOverlay(x,y,thisX,thisY,zoom,next) { | |
http://mt1.google.com/vt/lyrs=h@169000000&hl=en&x=5207&y=7354&z=14 | |
var url = 'http://mt1.google.com/vt/lyrs=h@169000000&hl=en&x='+thisX+'&y='+thisY+'&z='+zoom; | |
var image = new Image; | |
image.onload = function() { | |
next(x,y,image) | |
} | |
image.src = url | |
} | |
function gMap (x,y,thisX,thisY,zoom,next) { | |
var url = 'http://khm1.google.com/kh/v=102&x='+thisX+'&y='+thisY+'&z='+zoom; | |
var image = new Image; | |
image.onload = function() { | |
next(x,y,image) | |
} | |
image.src = url | |
} | |
$(document).ready(function() { | |
var canvas = document.getElementById('canvas'); | |
canvas.width = 256*right; | |
canvas.height = 256*down; | |
var ctx = canvas.getContext("2d"); | |
var x = 0; | |
var y = 0; | |
while (y < down) { | |
var x = 0; | |
while (x < right) { | |
var thisX = startX+x; | |
var thisY = startY+y; | |
gMap(x, y, thisX, thisY, zoom, function(x,y,image) { | |
var width = 256; | |
var height = 256; | |
ctx.drawImage(image, 0, 0, image.width, image.height, x*image.width, y*image.width, image.width, image.height); | |
//$('body').append($('<img>',{'src':image.src})) | |
}) | |
x++; | |
} | |
y++; | |
} | |
var x = 0; | |
var y = 0; | |
while (y < down) { | |
var x = 0; | |
while (x < right) { | |
var thisX = startX+x; | |
var thisY = startY+y; | |
gMapOverlay(x, y, thisX, thisY, zoom, function(x,y,image) { | |
var width = 256; | |
var height = 256; | |
ctx.drawImage(image, 0, 0, image.width, image.height, x*image.width, y*image.width, image.width, image.height); | |
//$('body').append($('<img>',{'src':image.src})) | |
}) | |
x++; | |
} | |
y++; | |
} | |
}) | |
</script> | |
</head> | |
<body> | |
<canvas id="canvas"></canvas> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment