類似這(zhè)樣子(zǐ)
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title data-i18n="resources.title_4326Map"></title>
<script type="text/javascript" src="../js/include-web.js"></script>
</head>
<body style=" margin: 0;overflow: hidden;background: #fff;width: 100%;height:100%;position: absolute;top: 0;">
<div id="map" style="margin:0 auto;width: 100%;height: 100%"></div>
<script type="text/javascript" exclude="iclient-classic" src="../../dist/classic/include-classic.js"></script>
<script type="text/javascript">
var map, layer,
host = window.isLocal ? window.server : "https://iserver.supermap.io",
url = host + "/iserver/services/map-world/rest/maps/World";
//初始化地(dì / de)圖
map = new SuperMap.Map("map", {
controls: [
new SuperMap.Control.Navigation(),
new SuperMap.Control.Zoom()]
});
map.addControl(new SuperMap.Control.MousePosition());
//初始化圖層
layer = new SuperMap.Layer.TiledDynamicRESTLayer("World", url, null, {maxResolution: "auto"});
//監聽圖層信息加載完成事件
layer.events.on({"layerInitialized": addLayer});
function addLayer() {
map.addLayer(layer);
//顯示地(dì / de)圖範圍
map.setCenter(new SuperMap.LonLat(0, 0), 0);
}
baiduLayer = new SuperMap.Layer.Baidu();
map.addLayers([baiduLayer]);
</script>
</body>
</html>
是(shì)将兩個(gè)圖層都疊加了(le/liǎo),但是(shì)因爲(wéi / wèi)都是(shì)全球地(dì / de)圖,所以(yǐ)隻能看到(dào)後添加的(de)baiduLayer,您可以(yǐ)切換下兩個(gè)addLayer方法的(de)執行順序,來(lái)驗證。