ArcGIS Runtime Android SDK100.1.0离线地图编辑和同步

时间:2017-08-31 07:37:30

标签: android arcgis esri arcgis-runtime arcgis-android-api

我可以从ArcGIS Android SDK-100.1.0下载地图,但之后我将如何编辑此地图,即添加或删除标记点,在此编辑后我需要将离线编辑数据同步到ArcGIS地图服务器。这是我的离线地图代码 -

private MapView mMapView;
private ArcGISMap map;
private ArcGISTiledLayer tiledLayer;
private Geodatabase geodatabase;
private Activity activity;

public void loadOfflineMap() {
    Toast.makeText(activity, activity.getFilesDir().getAbsolutePath(), Toast.LENGTH_LONG).show();

    //--- get links to cached resources
    String strTpkPath = activity.getFilesDir().getAbsolutePath()+"/tiles.tpk";
    String strGeoDbPath = activity.getFilesDir().getAbsolutePath()+"/layers.geodatabase";

    File sdCard = Environment.getExternalStorageDirectory();
    File dir = new File (sdCard.getAbsolutePath() + "/arcGIS");
    dir.mkdir();
    File file = new File(sdCard.getAbsolutePath() + "/testfile.txt");
    if (!file.exists()) {
        try {
            file.createNewFile();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    //--- create a tiled layer using the tile package
    TileCache tileCache = new TileCache(strTpkPath);
    tiledLayer = new ArcGISTiledLayer(tileCache);

    //--- set tiled layer as basemap
    Basemap basemap = new Basemap(tiledLayer);

    //--- create a map with the basemap
    map = new ArcGISMap(basemap);
    mMapView.setMap(map);

    //--- instantiate geodatabase with name
    geodatabase = new Geodatabase(strGeoDbPath);

    //--- load the geodatabase for feature tables
    geodatabase.loadAsync();

    //--- add feature layer from geodatabase to the ArcGISMap
    geodatabase.addDoneLoadingListener(new Runnable() {
        @Override
        public void run() {
            for (GeodatabaseFeatureTable geoDBTable: geodatabase.getGeodatabaseFeatureTables()) {
                mMapView.getMap().getOperationalLayers().add(new FeatureLayer(geoDBTable));
            }
        }
    });
}

我无法找到此版本的ArcGIS SDK的任何解决方案。请帮帮我。

1 个答案:

答案 0 :(得分:0)

您是否看过编辑指南: https://developers.arcgis.com/android/latest/guide/editing.htm

和同步: https://developers.arcgis.com/android/latest/guide/sync-offline-edits.htm

还有用于编辑附件的示例代码: https://developers.arcgis.com/android/latest/sample-code/edit-feature-attachments.htm

如果那些人没有回答您的任何问题,请告诉我,我会尝试进一步提供帮助。