你好,感谢回复我的问题。对我提出的问题,我补充一下:
1、web端也是显示同一个iserver发布的wmts图层,没有任何问题,应该可以排除数据发布或者数据的问题。
2、另一种方式(不通过iserver,直接调第三方,如国家天地图的服务),iclient for android,调用addLayers将多个图层添加,发现出现地图显示比较卡,相互覆盖的情况,另外坐标边界BoundingBox layerBounds = new BoundingBox(new Point2D(-360.0D, 180.0D),new Point2D(360.0D, -180.0D));只能设置360与180,否则只能显示一半的地图,设置后,经纬度坐标也相应需要乘以2,如Point2D pc = new Point2D(119.6846*2,29.80042*2);
采用的是地理坐标系(wgs84),设置(-180,180)、(-90,90)只能显示一半的世界地图,代码如下,调用的国家天地图服务,不经过iserver:
//创建地图窗口 mapView = (MapView) this.findViewById(R.id.mapview); //resolutions - 分辨率数组 double[] resolutions = {1.406250,0.703125,0.35156249999999994,0.17578124999999997, 0.08789062499999998, 0.04394531249999999,0.021972656249999996, 0.010986328125000003, 0.005493164062500002,0.002746582031250001, 0.0013732910156250004, 0.0006866455078125002,0.0003433227539062501, 0.00017166137695312505, 0.00008583068847656253,0.000042915344238281263, 0.000021457672119140632, 0.000010728836059570316,0.000005364418, 0.000002682209, 0.0000013411045};
//构造WMTS图层,以构建wmts1.0.0为例 List<String> tileMatrixIds = new ArrayList<String>(); for(int i=0;i<resolutions.length;i++){ // String matrixId = "identifier:"+(i+1); String matrixId = ""+(i+1); tileMatrixIds.add(matrixId); }
WMTSLayerView wmtsLayerView1= new WMTSLayerView(this, "http://t0.tianditu.com/vec_c/wmts", "vec", "c",false,resolutions,tileMatrixIds); WMTSLayerView wmtsLayerView2= new WMTSLayerView(this, "http://t0.tianditu.com/cva_c/wmts", "cva", "c",false,resolutions,tileMatrixIds); WMTSLayerView wmtsLayerView3= new WMTSLayerView(this, "http://srv.zjditu.cn/ZJEMAP_2D/wmts", "ZJEMAP_2D", "esritilematirx",false,resolutions,tileMatrixIds); WMTSLayerView wmtsLayerView4= new WMTSLayerView(this, "http://srv.zjditu.cn/ZJEMAPANNO_2D/wmts", "ZJEMAPANNO_2D", "esritilematirx",false,resolutions,tileMatrixIds); WMTSLayerView wmtsLayerView5= new WMTSLayerView(this, "http://220.191.208.96/TLZONE/service/wmts", "TLZONE", "TileMatrixSet0",false,resolutions,tileMatrixIds); WMTSLayerView wmtsLayerView6= new WMTSLayerView(this, "http://220.191.208.96/TLEMAP/service/wmts", "TLEMAP", "TileMatrixSet0",false,resolutions,tileMatrixIds); WMTSLayerView wmtsLayerView7= new WMTSLayerView(this, "http://220.191.208.96/TLEMAPANNO/service/wmts", "TLEMAPANNO", "TileMatrixSet0",false,resolutions,tileMatrixIds);
//添加wmts1.0.0图层 按照7-1顺序能显示地图,1-7顺序地图出不来?什么原因 WMTSLayerView[] wmtsLayerViews = {wmtsLayerView7,wmtsLayerView6 ,wmtsLayerView5,wmtsLayerView4,wmtsLayerView3, wmtsLayerView2,wmtsLayerView1};
//可以显示全地图 // BoundingBox layerBounds = new BoundingBox(new Point2D(-360.0D, 180.0D),new Point2D(360.0D, -180.0D)); //只能显示一半地图 BoundingBox layerBounds = new BoundingBox(new Point2D(-180.0D, 90.0D),new Point2D(180.0D, -90.0D));