Skip to content

Instantly share code, notes, and snippets.

@kconragan
Created May 8, 2012 17:54
Show Gist options
  • Save kconragan/2637953 to your computer and use it in GitHub Desktop.
Save kconragan/2637953 to your computer and use it in GitHub Desktop.
Google Maps custom tile overlay
// Set up the copyright information
// Each image used should indicate its copyright permissions
var myCopyright = new GCopyrightCollection("© ");
myCopyright.addCopyright(new GCopyright('Demo',
new GLatLngBounds(new GLatLng(-90,-180), new GLatLng(90,180)),
0,'©2007 Google'));
// Create the tile layer overlay and
// implement the three abstract methods
var tilelayer = new GTileLayer(myCopyright);
tilelayer.getTileUrl = function() { return "../include/tile_crosshairs.png"; };
tilelayer.isPng = function() { return true;};
tilelayer.getOpacity = function() { return 1.0; }
var myTileLayer = new GTileLayerOverlay(tilelayer);
var map = new GMap2(document.getElementById("map_canvas"));
map.setCenter(new GLatLng(37.4419, -122.1419), 13);
map.addOverlay(myTileLayer);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment