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);