`
devgis
  • 浏览: 133861 次
  • 性别: Icon_minigender_1
  • 来自: 西安
社区版块
存档分类
最新评论

MapXtreme加载瓦片地图

 
阅读更多
var map = null;
var mi_Base = null;
var mapName = "NA";
var outputfmt = "jpg";


function initialize() {
if (GBrowserIsCompatible()) {
map = new GMap2(document.getElementById("mapDIV"));
map.setCenter(new GLatLng(0, 0), 3);
map.setUIToDefault();
GetTiles();
// Make a call to tile handler to get list of maps
AjaxRequest.get(
{
'parameters': {},
'url': 'TileServer/maplist.json',
'onSuccess': listMaps,
'onError': function(req) { alert('Error!\nStatusText=' + req.statusText + '\nContents=' + req.responseText); }
}
);
}
}


function GetTiles() {
try {
map.removeOverlay(mi_Base);
}
catch (err) {
}
// Set up the copyright information
// Each image used should indicate its copyright permissions
var myCopyright = new GCopyrightCollection("c ");
myCopyright.addCopyright(new GCopyright('Overlay', new GLatLngBounds(new GLatLng(-90, -180), new GLatLng(90, 180)), 0, 'c2009 PBBI'));


// Create the tile layer overlay and
// implement the three abstract methods
var tilelayer = new GTileLayer(myCopyright);
tilelayer.getTileUrl = getPBBITiled;
tilelayer.isPng = function() { return true; };
tilelayer.getOpacity = function() { return 0.75; }


mi_Base = new GTileLayerOverlay(tilelayer);
map.addOverlay(mi_Base);
}




//
// Get the Cosmetic dynamic tiles
///
function getPBBITiled(tile, z) {
// "GET /TileServer/{mapname}/{level}/{x};{y}/tile.{ext}"


var path = "TileServer/" + mapName + "/" + z + "/" + tile.x + ";" + tile.y + "/tile." + outputfmt;
//var path = "http://localhost:8080/MapTilingService/RESTService/getTile?name=CasinoMap&level=" + (z + 1) + "&col=" +
// (tile.x + 1) + "&row=" + (tile.y + 1) + "&dpi=96&output=png";


return path;
}
分享到:
评论
2 楼 zhlfresh163.com 2013-08-13  
,请速回,我也正在玩百度地图,就这里自定义图层出现问题,需要高手提携
1 楼 zhlfresh163.com 2013-08-13  
var path = "TileServer/" + mapName + "/" + z + "/" + tile.x + ";" + tile.y + "/tile." + outputfmt;
这里你是怎么弄的?为什么会是这样呢?用到了什么切图工具吗?

相关推荐

Global site tag (gtag.js) - Google Analytics