首页 / 浏览问题 / 移动GIS / 问题详情
thirdpartlayerAPP天地图显示白屏
24EXP 2019年04月25日
iclient 8C for Android  里面的  thirdpartlayer的Demo 天地图显示白屏

1个回答

你好,

1.调试一下代码看天地图图层是否添加到mapview中

2.在天地图官网上面申请token,把代码中的tk值替换掉
9,127EXP 2019年04月26日
@Override
    public void initTileContext(Tile tile) {
        // 获取真正的出图层级,因为mapview的层级数是所有图层固定比例尺数组合并的长度
        int index = getResolutionIndex();
        if (index == -1) {
            return;
        }
        index += this.zOffset;
        int x = tile.getX();
        int y = tile.getY();
        int num = Math.abs((x + y) % 8);// tile0...7
        String lt = getlayerType();
        String proj = getProj();
//        String result = "http://tile" + num + ".tianditu.com/DataServer?T=" + lt + "_" + proj + "&X=" + x + "&Y=" + y + "&L=" + index;
        String result = "http://t" + num + ".tianditu.com/DataServer?T=" + lt + "_" + proj + "&X=" + x + "&Y=" + y + "&L=" + index;
        // &X=0&Y=0&L=2
        // String result = url + "&X=" + x + "&Y=" + y + "&L=" + index;
        // Log.d(LOG_TAG, "getTileURL:" + result);
        tile.setUrl(result);
    }

demo里哪来的tk?

demo是之前写的了,现在天地图服务都是需要加上token的。你需要在地址后面加上token
...