首页 / 浏览问题 / 移动GIS / 问题详情
iclient加载两个wmtsLayerView
7EXP 2018年04月12日
使用产品:iclient ;操作系统:android

supermap iclient加载两个wmtsLayerView,一个是地图,一个是文字,加载到的文字wmtslayerview背景为什么是白色的?地图服务的图片背景是透明的。

2 个回答

var map;
var shiliangtu,shiliangzhuji;
var basemapConfig=[{
                type : "WMTS",//矢量底图
                name : "vec",
                url : "http://t0.tianditu.com/vec_c/wmts",
                layer : "vec",
                matrixSet : "c",
                format : "tiles"
            },{
                type : "WMTS",//矢量标记图层
                name : "cva",
                url : "http://t0.tianditu.com/cva_c/wmts",
                layer : "cva",
                matrixSet : "c",
                format : "tiles"
            }];  //数组分解
			
//当前图层的分辨率数组信息,和matrixIds一样,需要用户从wmts服务获取并明确设置,resolutions数组和matrixIds数组长度相同
var resolutions = [1.40625, 0.7031249999999999936115128777990292,
	0.3515624999999999968057564388995146,0.1757812499999999984028782194497573,
	0.08789062500000014886216906166869328,0.04394531250000007443108453083434663,
	0.02197265625000000728339627502841039,0.01098632812500001860777113270858666,
	0.005493164062500009303885566354293329,0.002746582031250001658728184138270372,
	0.001373291015625000829364092069135186,0.0006866455078124989180747465151294470,
	0.0003433227539062494590373732575647235,0.0001716613769531250288401465326699910,
	0.00008583068847656251442007326633499548,0.00004291534423828140687076658511131235,
	0.00002145767211914064357109131177813033,0.00001072883605957030681947266069468370,
	0.000005364418029785168375809325541723313,0.000002682209014892578201475464693109072,
	0.000001341104507446289100737732346554536];
	
//wmts或许所需要的matrixID信息
var matrixIds = [];
//绘制线、面图层
var lineLayer,polygonLayer;
var TrackingLayerStyle = {
		strokeColor: "#EE6363",
		strokeWidth: 3,
		strokeOpacity: 0.8,
		pointerEvents: "visiblePainted",
		fillColor: "#304DBE",
		fillOpacity: 0.3
	};
//测量完成后的线、面图层
var measureLine,measurePolygon;
//中间结果显示
var measureVectorLayer;

function initmap(){
	map = new SuperMap.Map("map-map",{controls: [     
		new SuperMap.Control.Zoom({defaultPosition: new SuperMap.Pixel(20,40)}),
		//new SuperMap.Control.PanZoomBar(),
		//new SuperMap.Control.ScaleLine(),
		new SuperMap.Control.Navigation({
			dragPanOptions: {
				enableKinetic: true  
			}}), 
		]
    });
	
	map.allOverlays = true;
	
	for(var i = 0; i < 19; ++i) {
		matrixIds[i] = {
			identifier: i
		};
	};  //图层的级数设置

	//新建图层
	shiliangtu = new SuperMap.Layer.WMTS({
		name: "矢量底图",
		url: basemapConfig[0].url,
		layer: basemapConfig[0].layer,
		style: basemapConfig[0].style,
		matrixSet: basemapConfig[0].matrixSet,
		format: basemapConfig[0].format,
		resolutions: resolutions,
		matrixIds: matrixIds,
		opacity: 1,
		requestEncoding: "KVP"
	});
	shiliangzhuji  = new SuperMap.Layer.WMTS({
		name: "矢量标记图层",
		url: basemapConfig[1].url,
		layer: basemapConfig[1].layer,
		style: basemapConfig[1].style,
		matrixSet: basemapConfig[1].matrixSet,
		format: basemapConfig[1].format,
		resolutions: resolutions,
		matrixIds: matrixIds,
		opacity: 1,
		requestEncoding: "KVP"
	});

	map.addLayers([shiliangtu,shiliangzhuji]);

	map.setCenter(new SuperMap.LonLat(114.5439,38.03749), 16);
}

给你个加载天地图的参考

545EXP 2018年04月13日
谢谢 但是我的是android端的
请贴出在iclient for Android中两个图层叠加显示的关键代码和所用两个图层对象的url;另外还可以在iDesktop中将这两个在线数据在iDesktop中打开叠加显示看一下显示的效果。
2,042EXP 2018年04月13日
...