加载天地图代码如下,程序运行不报错,但是真机测试,界面空白
mapControl = mapView.getMapControl();
workspace = new Workspace();
// 将地图显示空间和 工作空间关联
mapControl.getMap().setWorkspace(workspace);
DatasourceConnectionInfo info = new DatasourceConnectionInfo();
info.setAlias("TianDiTu1");
info.setEngineType(EngineType.OGC);
info.setDriver("WMTS");
String url = "http://t0.tianditu.gov.cn/vec_c/wmts?tk=key";
info.setServer(url);
Datasource datasource = workspace.getDatasources().open(info);;
if (datasource != null) {
mapControl.getMap().getLayers().add(datasource.getDatasets().get(0), true);
mapControl.getMap().refresh();
}else {
Log.e(this.getClass().getName(), "打开数据源失败了");
}