2012-06-19 41 views

回答

0
<!DOCTYPE html> 
<html> 
<head> 
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> 
<style type="text/css"> 
     html { height: 100% } 
     body { height: 100%; margin: 0px; padding: 0px } 
     #map_canvas { height: 100%; z-index: 0;} 
     #gmnoprint {width: auto;} 
</style> 
<meta http-equiv="content-type" content="text/html; charset=utf-8"/> 
<title>my custom map</title> 
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"></script> 
<script> 
function CustomMapType() { 
} 
CustomMapType.prototype.tileSize = new google.maps.Size(256,256); 
CustomMapType.prototype.maxZoom = 5; 
CustomMapType.prototype.getTile = function(coord, zoom, ownerDocument) { 
    var div = ownerDocument.createElement('DIV'); 
    var baseURL = 'tiles/'; 
    baseURL +=zoom + '_' + coord.x + '-' + coord.y + '.png'; 
    div.style.width = this.tileSize.width + 'px'; 
    div.style.height = this.tileSize.height + 'px'; 
    div.style.backgroundColor = '#89919E'; 
    div.style.backgroundImage = 'url(' + baseURL + ')'; 
    return div; 
}; 

CustomMapType.prototype.name = "Custom"; 
CustomMapType.prototype.alt = "Tile Coordinate Map Type"; 
var map; 
var CustomMapType = new CustomMapType(); 
function initialize() { 
    var mapOptions = { 
     minZoom: 2, 
    maxZoom: 5, 
    isPng: true, 
     mapTypeControl: false, 
     streetViewControl: false, 
     center: new google.maps.LatLng(65.07,-56.08),  
     zoom: 3, 
    mapTypeControlOptions: { 
     mapTypeIds: ['custom', google.maps.MapTypeId.ROADMAP], 
     style: google.maps.MapTypeControlStyle.DROPDOWN_MENU 
    } 
    }; 
map = new google.maps.Map(document.getElementById("map_canvas"),mapOptions); 
map.mapTypes.set('custom',CustomMapType); 
map.setMapTypeId('custom'); 
} 
</script> 
</head> 
<body onload="initialize()"> 
<div id="map_canvas" style="background: #1B2D33;"></div> 
</body> 
</html> 

使用的代碼,把瓷磚放入文件夾輸出=)

+0

你叫哪個文件夾「文件夾輸出」? –