/IncidentCollectionViewerDemo

ArcGIS Runtime SDK for .NET Offline Editing Example

Primary LanguageC#

IncidentCollectionViewerDemo

ArcGIS Runtime SDK for .NET Offline Editing Example

ArcGIS Runtime SDK for .NET 10.2.4 can use the new runtime geodatabase for offline editing but it needs as its parent a feature service. This sample uses a service-less methodology by starting with a map package exported from ArcGIS for the editable "LocalFeatureService" (Incidents).

Update: This approach does not use the Runtime LOCALSERVER option to wrap a map package from ArcMap and just uses the map to draw temporary graphics. I cleaned up the UI also. But at the same time I added another little piece for fun using the File Geodatabase API (unrelated to the Runtime) to persist and load the features in the app. You could do the same thing using custom XML or CSV for sure but this is kind of nice because you can access the file geodatabase independently of the app.

 

A read-only "Operational Layer" (counties) is added by using the runtime geodatabase option generated from the File | Share As | Runtime Content command.

An offline basemap was generated by using a sample code (https://github.com/Esri/arcgis-runtime-samples-dotnet/blob/master/src/Desktop/ArcGISRuntimeSDKDotNet_DesktopSamples/Samples/Offline/ExportTileCache.xaml.cs).

http://doc.arcgis.com/en/collector/android/create-maps/offline-map-prep.htm

An offline locator is also used which is generated by adding it to the map before generating the runtime content and setting the option to include it in the output.

 

The result is a directory with the offline basemap, the map package for incidents, the runtime geodatabase with the operational layer (localgovernment.geodatabase), and the offline locator (streetname.loc).

The app loads with an online basemap, the local operational layer, and the local editable feature service.  

  Clicking the Offline option switches to use the local tile cache basemap.

When offline, the offline locator is used. The demo is based on Naperville. Eagle St is a valid street to search for.

  The Add Location tool adds a point to the local editable feature service.

The submit button applies the edit to the local feature service.

    When the local feature service was created, the map package of incidents was unpacked to a windows directory as a file geodatabase. The default location, which can be changed programmatically is: C:\Users<username>\AppData\Local\ArcGISRuntime\Documents\ArcGIS\Packages  

  After the edits have been applied, they are persisted in the underlying file geodatabase and can be reviewed in ArcGIS desktop, or custom code could export them to alternative formats.