2017-08-31 40 views
0

我可以從ArcGIS Android SDK-100.1.0下載地圖,但之後我將如何編輯此地圖,即添加或刪除標記點,並在此編輯之後我需要將離線編輯數據同步到ArcGIS Map服務器。這裏是我的離線地圖代碼 -ArcGIS Runtime Android SDK100.1.0離線地圖編輯和同步

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。請幫幫我。

回答

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

如果這些不回答任何你的問題,讓我知道,我會盡力幫助進一步。

+0

感謝您的回覆,但您發送的內容僅僅是一個鏈接,除了同步鏈接以外,還有我觀看過的所有上述三個鏈接。同步將在編輯後完成。所以我的關注點是如何編輯下載的地圖並在此之後同步。編輯功能是不同的事情。 –

+0

編輯下載的地圖是什麼意思?您是否嘗試修改要素圖層? – falldownhill

+0

是的。假設我想在特定點上添加標記,這一點將會同步,並且它還會在下次顯示在線服務以及離線服務 –