代码如下;
FIRSTvar map,layer;
// 设置访问的GIS服务地址
var url = "http://localhost:8090/iserver/services/map-ChinaProvinces/rest/maps/ChinaProvinces";
// var url = "http://localhost:8090/iserver/services/map-LinBan/rest/maps/map-LinBan";
function onPageLoad() {
// 创建地图对象
map = new SuperMap.Map("map");
// 创建图层对象
layer = new SuperMap.Layer.TiledDynamicRESTLayer("ChinaProvinces", url,{transparent: true, cacheEnabled: true}, {maxResolution:"auto"});
layer.events.on({"layerInitialized": addLayer});
}
function addLayer() {
// 向Map中添加图层
map.addLayer(layer);
map.setCenter(new SuperMap.LonLat(0, 0), 0);
}