Editing means that you can add, update, and delete features, online and offline. Updating features includes modifying feature attributes—changing the value of a feature's fields according to the type and range of values allowed—and modifying feature geometry, such as moving a point feature or re-shaping a polygon feature.
Editing also includes adding, updating, and deleting feature attachments. For example, if you are editing features representing wildlife sightings, the feature geometry can represent the sighting's location, the feature attributes can include the sighting's description and time, and you can add a photo of the sighted wildlife as an attachment to the feature.
Whether your app enables users to edit online (connected), offline (disconnected), or both, editing always requires an associated feature service. You can create fully-featured feature services using ArcGIS for Server, and basic hosted feature services using the ArcGIS for Developers website. For more information, see Prepare an editing environment. You will ultimately submit any edits made to features in your Runtime app to a feature service. In an online editing workflow, edits should be sent back to the associated service as soon as they are made. For an offline editing workflow, before going offline, create a local geodatabase from a sync-enabled feature service to contain the features you want to edit. Edits made to those features while offline are recorded in the geodatabase and can be synced with the originating feature service when back online.
You can use the ArcGIS Runtime SDK for .NET to build an app that lets users edit online, offline, or both. After creating a feature table from a feature service or geodatabase, you can edit the features in the table using add, update, and delete methods. A feature layer (FeatureLayer class) displays your features on the map, but the editing operations are performed on the underlying feature table (GeodatabaseFeatureTable and ServiceFeatureTable classes).
The code to implement feature table edits is the same regardless of whether the feature table is based on a feature service (online source) or local geodatabase table (offline source). For offline editing workflows, additional code is needed to Sync offline edits back to the feature service.
If you are building an app for which you can assume network connectivity is always available, you can support editing with a ServiceFeatureTable. This table contains features from an online data source (feature service) and can be displayed in a FeatureLayer.
Similarly, if you are building an app that needs to support both online and offline editing workflows, you can support offline editing with a GeodatabaseFeatureTable. This table contains features from a local data source (geodatabase) and can also be displayed in a FeatureLayer. The data in a GeodatabaseFeatureTable, while stored locally, can be synchronized with an online feature service when connectivity is available. Logic in your app can respond to connectivity changes and use online or offline data and editing strategies as appropriate.
For more information on editing geodatabase feature tables online and offline, see Edit features.
If you are building an app in which your users need to edit features offline, use the editing workflow described in Edit features. Before going offline, provision a local geodatabase using ArcGIS for Desktop or create one from a sync-enabled feature service using the API, as described in Create an offline map. Edit the features in the geodatabase on your local machine when offline, and sync those edits back to the service when online again, as described in Sync offline edits.
Prepare an editing environment
Editing requires a feature service to provide the symbology, feature geometry, and set of attribute fields (schema) for your features. Feature services contain service layers (feature data) and tables (nonspatial, tabular data) that you edit via a feature table or feature layer in an online workflow, or use to prepare editable data for an offline workflow. For more information about feature services, see What is a feature service?
Before you build an app that performs editing, you need a feature service that exposes the layers you want to edit. There are various ways to publish a feature service.
- You can login to your organization's portal and publish features from a variety of data sources such as CSV files, GeoJSON, shapefiles, feature collections, or file geodatabases. All of these options and their steps are outlined in the publish hosted feature services topic.
- You can also publish feature services using ArcGIS for Desktop. This involves setting up a map document, and defining a feature class schema or importing an existing feature class. Optionally, you can define feature templates to make it easy for the app's end user to create common features. You can then publish the map as a feature service to an ArcGIS for Server or as a hosted service in ArcGIS Online or Portal for ArcGIS. When you publish the service, make sure that you have the Feature Access capability enabled, and that the service is sync-enabled.
- You can also create a feature layer using the ArcGIS for Developers site. Log in to the site using your organization account or your free developers subscription. Access the Layers tab and click the Create New Layer button. Follow the instructions to create the new feature layer ensuring that you have checked the box to enable the layer to be taken offline to allow it to be viewed, edited, and synchronized. After creating a layer you can add data to it in the ArcGIS Online Map Viewer.
For an offline editing workflow, create a sync-enabled feature service. A sync-enabled feature service allows you to generate a geodatabase for offline use, and gives you the ability to sync your local edits back to the service.
ArcGIS 10.2.2 for Server or later is required to publish sync-enabled feature services.
Edits made to features in your Runtime application need to be committed back to the feature service. In an online editing workflow, edits should be sent back to the service as soon as they are made. For an offline editing workflow, sync edits made while offline back to the service, as described in Sync offline edits.