我是arcmap地图中的新手,我已经花了超过2周的时间停留在线下如何在线显示地图。 我已经尝试了附加代码,但是当我运行应用程序时。它没有任何显示崩溃。 您可以看到我的代码,我还附加了地理数据库文件。
我遵循本教程: http://www.activeg.com/agBlog/android-running-an-arcgis-map-offline
我的地理数据库文件就在这里 https://files.fm/u/q5xuznvy
我只想提前感谢那些愿意分享的人。
MapView mMapView;
Geodatabase geodatabase;
private GeodatabaseFeatureTable geodatabaseFeatureTable;
private FeatureLayer featureLayer;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mMapView = (MapView) findViewById(R.id.map); //Instantiates the MapView object
LoadMap mLoadMap = new LoadMap(); //Runs the LoadMap class on another thread
mLoadMap.execute(); //Calls the background thread
}
private class LoadMap extends AsyncTask<Void, Void, Void> {
@Override
protected Void doInBackground(Void... params) {
try { //Opens up the basemap.geodatabase file from it's location on the physical device
Log.d("_EXC", "Loading File");
geodatabase = new Geodatabase("/mnt/shared/Database/mygeodata.gdb");
Log.d("_EXC", "File Loaded");
} catch (FileNotFoundException e) {
Log.d("_EXC", e.getMessage());
} finally { //Takes each layer one by one from the Geodatabase and adds it to the MapView
if (geodatabase == null){
Log.d("_EXC", "File not Loaded");
}
for (int i = (geodatabase.getGeodatabaseTables().size()) - 1; i >= 0; i--) {
geodatabaseFeatureTable = geodatabase.getGeodatabaseFeatureTableByLayerId(i);
featureLayer = new FeatureLayer(geodatabaseFeatureTable);
mMapView.addLayer(featureLayer);
}
}
return null;
}
}
}`