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();
DatasourceConnectionInfo dsInfos = new DatasourceConnectionInfo();
DatasourceConnectionInfo dsInfos3 = new DatasourceConnectionInfo();
DatasourceConnectionInfo dsInfos4 = new DatasourceConnectionInfo();
dsInfos4.setServer("http://220.165.249.18:8099/iserver/services/map-XGLLS533401/rest/maps/map");
dsInfos4.setEngineType(EngineType.Rest);
dsInfos4.setAlias("ChinaRest");
// dsInfo.setAlias("GoogleMapRoad");
// dsInfo.setEngineType(EngineType.GoogleMaps);
// String url ="http://www.google.cn/maps";
String url3 = "http://220.165.249.18:8099/iserver/services/map-XGLLS533401/wmts100";
// dsInfos3.setServer(url3);
// dsInfos3.setAlias("JCTB");
// dsInfos3.setEngineType(EngineType.OGC);
// dsInfos3.setDriver("WMTS");
dsInfos3.setAlias("WMTS1");
dsInfos3.setEngineType(EngineType.OGC);
dsInfos3.setDriver("WMTS");
dsInfos3.setServer(url3);
String url = "http://t0.tianditu.gov.cn/img_c/wmts?dpi=96&tk=493052acd769f94413bb19a27879476b";
dsInfo.setServer(url);
dsInfo.setAlias("TianDiTu1");
dsInfo.setEngineType(EngineType.OGC);
dsInfo.setDriver("WMTS");
String url2 = "http://t0.tianditu.com/cia_c/wmts?dpi=96&tk=493052acd769f94413bb19a27879476b";
dsInfos.setServer(url2);
dsInfos.setAlias("TianDiTu2");
dsInfos.setEngineType(EngineType.OGC);
dsInfos.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);
Datasource ds2 = m_workspace.getDatasources().open(dsInfos);
Datasource ds3 = m_workspace.getDatasources().open(dsInfos3);
Datasource ds4 = m_workspace.getDatasources().open(dsInfos4);
Log.e("eeds3",String.valueOf(ds3.getDatasets().getCount()));
Log.e("eeds2",String.valueOf(ds.getDatasets().getCount()));
if(ds3 != null){
Log.e("ee",String.valueOf(ds.getDatasets().getCount()));
m_mapControl.getMap().getLayers().add(ds.getDatasets().get(0), true);
// m_mapControl.getMap().getLayers().add(ds3.getDatasets().get(0), true);
m_mapControl.getMap().getLayers().add(ds3.getDatasets().get(0), true);
m_mapControl.getMap().getLayers().add(ds2.getDatasets().get(0), true);
Point2D mPoint = new Point2D(99.85 , 27.87 );
m_mapControl.getMap().setCenter(mPoint);
Log.e("DPIee",String.valueOf(m_mapControl.getMap().getMapDPI()));
// m_mapControl.getMap().setScale(1/12322.6);
m_mapControl.getMap().refresh();
Log.e("DPIee",String.valueOf(m_mapControl.getMap().getMapDPI()));
Log.e("DPIee",String.valueOf(m_mapControl.getMap().getCenter().getX())+String.valueOf(m_mapControl.getMap().getCenter().getY()));
return true;
}
Log.e(this.getClass().getName(), "打开数据源失败了");
return true;
}