首页 / 浏览问题 / 其他 / 问题详情
iclient8c 两个wmts同时加载
34EXP 2018年09月25日
同时加载全国天地图和某省份天地图冲突

1个回答

您是怎么进行加载的?用到监听事件了么?
5,668EXP 2018年09月25日
请问监听事件里要判断什么?进行哪些操作?新手不太清楚
您可以加载一个WMTS之后用监听事件,监听的是加载该图层完成后加载第二个WMTS,就是实现一个异步加载的过程
而且要确保这两个图层的坐标系和比例尺一致。

var map, layer,
url="http://web.dcyun.com:38149/iserver/services/map-wmts-ZJEMAP2D/wmts100";
function init(){
map = new SuperMap.Map("map",{controls: [
new SuperMap.Control.LayerSwitcher(),
new SuperMap.Control.ScaleLine(),
new SuperMap.Control.Zoom(),
new SuperMap.Control.Navigation({
dragPanOptions: {
enableKinetic: true
}
})],allOverlays: true
});

//wmts或许所需要的matrixID信息
var matrixIds = [];
for (var i=0; i<22; ++i) {
matrixIds[i] = {identifier:i};
};
//当前图层的分辨率数组信息,和matrixIds一样,需要用户从wmts服务获取并明确设置,resolutions数组和matrixIds数组长度相同
var resolutions = [1.25764139776733,0.628820698883665,0.251528279553466,
0.125764139776733,0.0628820698883665,0.0251528279553466,
0.0125764139776733,0.00628820698883665,0.00251528279553466,
0.00125764139776733,0.000628820698883665,0.000251528279553466,
0.000125764139776733,0.0000628820698883665,0.0000251528279553466,
0.0000125764139776733, 0.00000628820698883665,0.00000251528279553466,
0.00000125764139776733,0.000000628820698883665,0.000000251528279553466];
//新建图层
layer = new SuperMap.Layer.WMTS({name: "ZJEMAP_2D",
url: url,
layer: "ZJEMAP_2D",
style: "default",
matrixSet: "GlobalCRS84Scale_ZJEMAP_2D",
format: "image/png",
resolutions:resolutions,
matrixIds:matrixIds,
opacity: 1,
requestEncoding:"KVP"});

layer_vec = new SuperMap.Layer.Tianditu({ "layerType": "vec" });

//图层添加并显示指定级别
map.addLayers([layer]);//成功加载

//map.addLayers([layer_vec,layer]);//加载失败
map.setCenter(new SuperMap.LonLat(120, 30), 5);

您可以试一下layer_vec = new SuperMap.Layer.Tianditu({ "layerType": "vec" });换成上面那种方式去加载天地图,保证他们的 resolutions一致试一下
...