private boolean openMap(){
m_workspace = new Workspace();
m_mapView = (MapView)findViewById(R.id.Map_view);
m_mapControl = m_mapView.getMapControl();
m_mapControl.getMap().setWorkspace(m_workspace);
DatasourceConnectionInfo dsInfo = new DatasourceConnectionInfo();
// dsInfo.setServer("http://220.165.249.18:8099/iserver/services/map-532503MengZiShi/rest/maps/map");
// dsInfo.setEngineType(EngineType.Rest);
// dsInfo.setAlias("ChinaRest");
// dsInfo.setAlias("GoogleMapRoad");
// dsInfo.setEngineType(EngineType.GoogleMaps);
// String url ="http://www.google.cn/maps";
String url = "http://t0.tianditu.gov.cn/img_c/wmts?tk=493052acd769f94413bb19a27879476b";
dsInfo.setServer(url);
dsInfo.setAlias("TianDiTu1");
dsInfo.setEngineType(EngineType.OGC);
dsInfo.setDriver("WMTS");
// String url = "http://t0.tianditu.gov.cn/img_c/esri/wmts?tk=493052acd769f94413bb19a27879476b";
// String url = "http://t0.tianditu.gov.cn/img_c/wmts?tk=493052acd769f94413bb19a27879476b";
// dsInfo.setServer(url);
Datasource ds = m_workspace.getDatasources().open(dsInfo);
if(ds != null){
Log.e("ee",String.valueOf(ds.getDatasets().getCount()));
m_mapControl.getMap().getLayers().add(ds.getDatasets().get(0), true);
// Point2D mPoint = new Point2D(34645459.182263, 2589269.150694);
// m_mapControl.getMap().setScale(1.0 / 1128.49943332672);
// m_mapControl.getMap().setCenter(mPoint);
m_mapControl.getMap().refresh();
m_mapControl.getMap().setVisibleScalesEnabled(true);
return true;
}
Log.e(this.getClass().getName(), "打开数据源失败了");
return true;
}
问题:
数据源也打开成功,不报错,但显示空白。
用了SuperMap iMobile 10i (V10.0.0)