IS.NET客户端聚合GoogleMap浅析(四)通过Tilelayer叠加GoogleMap

  最后就是Tilelayer来叠加GoogleMap了,根据我们定义好的传递参数,制定请求字符串,请求处理页面就行了。

    

代码
function addGM() {
//offset();
mapType = "Map";
map.CustomLayer.InsertTileLayer(
"GoogleMap", GetGTileID, GetGTileUrl, null, 0, 0, 0, 1, 10, 256, 256, null);
}
function GetGTileID(tx, ty, ms) {
return "gm_" + tx + "_" + ty + "_" + ms;
}
function GetGTileUrl(tx, ty, ms) {
var tileBounds = map.GetTileBounds(tx, ty, 256, 256); //获取图幅的地图范围,其中 tx 为图幅横向索引值, ty 为图幅纵向索引值, ms 为图幅显示比例尺。
var lb = tileBounds.leftBottom; //获取地图矩形的 leftBottom 字段。
var rt = tileBounds.rightTop; //获取地图矩形的 rightTop 字段。
// return "GoogleMap.ashx?lbx=" + lb.x + "&lby=" + lb.y + "&rtx=" + rt.x + "&rty=" + rt.y + "&tx=" + tx + "&ty=" + ty + "&ms=" + ms + "&type=" + mapType + "&offsetX=" +offsetX + "&offsetY=" + offsetY + "&t=" + Math.random();
return "GoogleMap.ashx?lbx=" + lb.x + "&lby=" + lb.y + "&rtx=" + rt.x + "&rty=" + rt.y + "&tx=" + tx + "&ty=" + ty + "&ms=" + ms + "&type=" + mapType + "&t=" + Math.random();
}
原文地址:https://www.cnblogs.com/yuxichina/p/1771553.html