Prepare data

Before performing edit operations, you need to carefully consider the source data you are working with. To start, ensure your data source has the exact schema necessary for your editing requirements. Some things to consider are the geometry type of your features, relevant data types for attributes, whether your application will need to work in an offline environment, and so on. Another important consideration is whether your application will need more advanced behavior such as subtypes, contingent values, or attribute rules. If data sources and their associated schema have already been defined and created for your application, your focus would be to perform edits in an ArcGIS Maps SDK for Kotlin application. However, it is possible that you might be required to create the source data that will be used in your application. The following topic covers scenarios that might require your consideration before performing edits.

Creating feature services

Feature services 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 for both online and offline feature service workflows. Feature services allow for scalable multi-client editing for data which changes over time. For more information about feature services, see What is a feature service? in the ArcGIS Enterprise documentation.

Before you build an app that performs feature service 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 log in 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 these options and their steps are outlined in the publish hosted feature services topic in the ArcGIS Online documentation.

  • You can publish a feature service using ArcGIS Pro to ArcGIS Online or ArcGIS Enterprise. For offline workflows, you must enable the Feature Access capability and ensure that the service is sync-enabled. For more information, see Prepare data for offline use documentation.

  • You can create a feature layer using the ArcGIS Developer site. Log in to the site using your ArcGIS Online or free ArcGIS Developer account. Access the Layers tab and click the Create New Layer button. For offline workflows, 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.

However you publish your service, REST URLs (endpoints) are created to both a map service and a feature service. Use these URLs to reference the services in your app. The map service endpoint can be used for read-only access to features (viewing only), so make sure to reference the feature service endpoint for editing. Offline editing workflows require sync-enabled feature services. 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.

Building forms

When a web map in your application contains feature layers (hosted feature layers, hosted feature layer views, or ArcGIS Server feature layers), it is possible to expose a form to your end users to ease data entry for a feature's attributes. A form can be defined for every feature layer in the web map or only those layers that you know the users will need to edit attributes for. When a form is configured, you specify what form elements the form contains and how the elements appear. Having a form helps guide users to the correct fields and allowable attribute values for each editable field. The form, when defined, is saved as part of the web map JSON definition and can be configured in the map viewer in ArcGIS Online, ArcGIS Enterprise, or the Field Maps Designer. These forms must be defined in the web map before any of these advantages can be realized in your Kotlin Maps SDK application.

To display a feature form in your application, the recommended approach is to use the open source toolkit component. The toolkit uses the Kotlin Maps SDK to process the JSON form definition contained in the web map and display the form for a given feature. In addition, it handles the interaction between the end user and the form while collecting the attribute data for a feature, evaluating any defined Arcade expressions contained in the form definition to minimize data entry errors. For development cases that go beyond the capabilities of the toolkit, you can work with the API directly to display a feature form in your application. To learn more about the API, see Edit attribute values.

Using feature collections

Feature collections are static collections of features stored as JSON inside the map or a referenced portal item. Many ArcGIS Online operations create feature collections, such as adding Map Notes to your map, importing shapefiles, importing GPX files or sharing analysis results as items. There are two representations of feature collections that are important to understand when it comes to editing and saving features.

  1. Feature collections in a map - feature JSON is saved in a single map as a feature collection layer.

  2. Feature collections as portal items - feature JSON is saved as a portal item. These feature collections can be referenced in multiple maps.

The workflow for editing the features for both types of feature collections is the same. However, there are differences when persisting the edits so that other users can see them. Feature collections in a map persist when the map is saved. Others who open the map will see the edited features. Feature collections stored as portal items are not saved when the map is saved, you must update or save a portal item to ensure that others will see the edited features.

Feature collections should not be used for multi-user editing scenarios, as clients could easily hold on to older versions of the feature collection and overwrite each other's changes. Use feature services for these types of workflows.

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.