/ Published in: JavaScript
Expand |
Embed | Plain Text
if (GBrowserIsCompatible()) { // // Set up the copyright information // // Each image used should indicate its copyright permissions // var myCopyright = new GCopyrightCollection("(c) "); // 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 "http://fundrace.huffingtonpost.com/gmaps/tiles/white.png"; }; // tilelayer.isPng = function() { return true;}; // tilelayer.getOpacity = function() { return 0.5; } // // var myTileLayer = new GTileLayerOverlay(tilelayer); map = new GMap2(document.getElementById("map_canvas")); map.addControl(new GSmallMapControl()); map.setCenter(new GLatLng(47,2, 1.2), 8); // map.setMapType(map.getMapTypes()[0]); // map.setCenter(new GLatLng(47,2, 1.2), 8); // map.addOverlay(myTileLayer); addHybridLayers(map, ['http://fundrace.huffingtonpost.com/gmaps/tiles/white.png'], new GLatLng(47,2, 1.2), 8); } } function addHybridLayers(aMap, tile_urls, labels, centerPoint, zoom) { var tilelayers = []; var hybridLayer = []; CustomMapTypes = []; for (var mapIndex = 0; mapIndex < tile_urls.length; mapIndex++) { tilelayers[mapIndex] = new GTileLayer(new GCopyrightCollection("Huffington Post"),5,15); tilelayers[mapIndex].getCopyright = function(a,b) { return {prefix:"Imagery: © 2007", copyrightTexts:["Huffington Post"]}; } tilelayers[mapIndex].getTileUrl = tile_urls[mapIndex]; hybridLayer[mapIndex] = [ tilelayers[mapIndex], // a reference to the tile layer from the first custom map G_HYBRID_MAP.getTileLayers()[1] // a reference to the upper tile layer of the hybrid map ]; CustomMapTypes[mapIndex] = new GMapType(hybridLayer[mapIndex], G_SATELLITE_MAP.getProjection(), labels[mapIndex]); CustomMapTypes[mapIndex].getMinimumResolution = function() {return 3;}; CustomMapTypes[mapIndex].getMaximumResolution = function() {return 16;}; aMap.addMapType(CustomMapTypes[mapIndex]); } aMap.removeMapType(G_SATELLITE_MAP); aMap.removeMapType(G_HYBRID_MAP); aMap.removeMapType(G_NORMAL_MAP); }
You need to login to post a comment.
