<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Google Maps JavaScript API v3 Example: Image MapTypes</title>
<script type="text/javascript" src="gapi.js"></script>
<script>
function CoordMapType(tileSize) {
this.tileSize = tileSize;
}
CoordMapType.prototype.getTile = function(coord, zoom, ownerDocument) {
var div = ownerDocument.createElement('DIV');
var ymax = 1 << zoom;
var y = ymax - coord.y - 1;
div.innerHTML = coord.x + "," + y + "," + zoom;
div.style.width = this.tileSize.width + 'px';
div.style.height = this.tileSize.height + 'px';
div.style.fontSize = '10';
div.style.borderStyle = 'solid';
div.style.borderWidth = '1px';
div.style.borderColor = '#AAAAAA';
return div;
};
function LocalMapType() {}
LocalMapType.prototype.tileSize = new google.maps.Size(256, 256);
LocalMapType.prototype.maxZoom = 10;
LocalMapType.prototype.minZoom = 6;
LocalMapType.prototype.name = "本地";
LocalMapType.prototype.alt = "显示本地地图";
LocalMapType.prototype.getTile = function(coord, zoom, ownerDocument) {
var img = ownerDocument.createElement("img");
img.style.width = this.tileSize.width + "px";
img.style.height = this.tileSize.height + "px";
var ymax = 1 << zoom;
var y = ymax - coord.y - 1;
var strURL = "tilemap\\" + zoom + "\\" + coord.x + "\\" + y + ".png";
img.src = strURL;
return img;
};
var localMapType = new LocalMapType();
function initialize() {
var myLatlng = new google.maps.LatLng(34.611, 108.935);
var myOptions = {
center: myLatlng,
zoom: 6,
streetViewControl: false,
mapTypeControlOptions: {
mapTypeIds: ["local", google.maps.MapTypeId.ROADMAP]
}
};
var map = new google.maps.Map(document.getElementById("map_canvas"),
myOptions);
map.mapTypes.set('local', localMapType);
map.setMapTypeId('local');
map.overlayMapTypes.insertAt(0, new CoordMapType(new google.maps.Size(256, 256)));
}
</script>
</head>
<body onload="initialize()">
<div id="map_canvas" style="width: 640px; height: 480px;"></div>
</body>
</html>
weixin_38744435
- 粉丝: 373
- 资源: 2万+
最新资源
- springboot700就业信息管理系统--论文.zip
- springboot701广场舞团--论文.zip
- springboot702应急救援物资管理系统.zip
- 基于晏殊《类要》的意气实体过程标注非欧几何设计源码
- springboot703招生管理系统--论文.zip
- springboot704招聘信息管理系统--论文.zip
- 基于C#语言开发的成都银海COM接口转webapi国家医保平台API服务源码
- springboot706时间管理系统--论文.zip
- springboot705数码论坛系统设计与实现--论文.zip
- springboot707智慧外贸平台--论文.zip
- springboot708智能热度分析和自媒体推送平台.zip
- springboot710校园交友网站--论文.zip
- springboot709校友社交系统--论文.zip
- Python爬虫实战:中国天气网天气数据抓取与解析
- springboot711校园医疗保险管理系统.zip
- springboot712校园台球厅人员与设备管理系统--论文.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈