Desperately seeking Javascript help
Andy Wardley
abw at wardley.org
Sat Jul 18 18:41:00 BST 2009
David Cantrell wrote:
> Can anyone point me at a tutorial which will show me how to put a map in
> a page, point it at my own map tiles, and Just Work?
<points/>
http://wardley.org/misc/map_overlay.html
It's not a tutorial but it shows the 20 or so lines of code you need to
create a custom tile overlay in a google map. It's based on the example in
the google maps docs:
http://code.google.com/apis/maps/documentation/overlays.html#CustomMapTiles
You'll also need a <script> tag in the page header to load the google maps
library and something to call show_map() when the documents loads. You can
do that with <body> attributes like this:
<body onload="show_map();" onunload="GUnload();">
Or using jQuery, like this:
<script>
$(document).ready(show_map).unload(GUnload);
</script>
Then all you need to do it write your own function to return the correct
map tile for the lng/lat/zoom:
tiles.getTileUrl = function(point,zoom) {
// return a URL for the tile image at point.x, pointy at
// zoom level zoom
};
HTH
A
More information about the london.pm
mailing list