Editing features

Feature layers, using the feature service introduced with ArcGIS Server 10, support editing geographic data over the web. Since you can provide a simple, familiar, and free application, web-based editing allows a larger group of people to add to and improve your data. These include field workers, analysts in other departments of your company, or perhaps even crowd-sourced volunteers who may be able to make valuable contributions to your data given a simple editing interface.

The ArcGIS API for Silverlight includes fine-grained components and prepackaged controls that help you add and enhance editing functionality in your applications. For example, you can predefine a set of feature templates, new in ArcGIS 10, to make it easier for users to add certain types of common features. You can also limit the attributes that can be added, and add some available attribute options in a drop-down list to facilitate accurate, uniform data entry. As the designer of a web editing application, you have complete control over how simple or complex an editing experience you expose to your users.

Web editing requires some initial setup of a feature service, which exposes information about a layer's feature geometries and attributes. Also, a geometry service is used to accomplish some web editing tasks. For example, to use the EditorWidget control in the ArcGIS Toolkit, you must have a running geometry service.

Using the editing functionality

The ArcGIS API for Silverlight provides simple feature editing. The features must come from an ArcSDE geodatabase hosted in an ArcGIS Server feature service. This geodatabase can be licensed for either workgroup or enterprise use and does not have to be versioned.

When editing data, you can add, move, delete, cut, union, and reshape features. You can also edit feature attributes. If you attempt to modify a particular feature at the same time as someone else, the last (most recent) edits submitted are the ones committed to the database.

For some web editing workflows, it's a good idea to have an analyst using ArcGIS for Desktop periodically review the edits to verify data integrity. Although components in the ArcGIS API for Silverlight can perform some data validation, other tasks, such as validating topologies, cannot be performed over the web.

Adding editing functionality to an application

Once you've added an editable feature layer to your application, you can start using edit components in the API. The easiest way to get started is to use the out-of-the-box controls included with the ArcGIS Toolkit library (ESRI.ArcGIS.Client.Toolkit.dll). The following controls are available:

Editor Widget

The Editor Widget is the default editing interface included with the API. It is a templateable control that includes a toolbar and a Template Picker to select the type of feature to add. Feature service capabilities and property settings on the control dictate which tools are displayed and how they function.

If you do not use the Editor Widget, you need to code your own editing experience. However, you can still take advantage of other edit controls in the ArcGIS Toolkit, such as the Template Picker, Feature Data Form, and Feature Data Grid.

Template Picker

The Template Picker displays a set of preconfigured feature choices that the user can create. The symbols visible in the Template Picker can either come from the editing templates defined in the feature service's source map, or they can be a set of symbols that are defined in the application. The Template Picker is a great way to expose preconfigured feature types for easy editing and quality control.

A Template Picker is included in the Editor Widget, but you can also use the Template Picker on its own as a simple legend for your map.

Feature Data Form and Feature Data Grid

When you make attributes available for editing on the web, you need to provide an interface for users to edit the attributes, and you must ensure that the data they enter is valid. The Feature Data Form and Feature Data Grid controls can help you with both of these tasks.

The Feature Data Form reads the attribute fields available through your feature layer and generates a user interface for easily updating those fields. The Feature Data Grid presents attribute fields and values of a graphic layer in a data grid. If the Feature Data Grid contains attributes for an editable feature layer, attribute values can be edited directly within the control. Commit the edits by either navigating away from the edited cell or explicitly saving the edits, depending on the feature layer settings.

Both controls validate data entered in the fields, ensuring that the input matches the expected data type. For example, if a coded value domain is applied to a field, the permitted values appear in a drop-down list, restricting the possibility of other values being entered. If a field requires a date value, a calendar appears, helping the user to supply a valid date. All available fields in the layer are included for editing. To restrict the available attributes, you must code your own interface for entering and validating values.

How the editing works

Editing with the ArcGIS API for Silverlight requires a feature service, a service available with ArcGIS Server 10 and later. Editing workflows can also take advantage of the ArcGIS Server geometry service.

Feature service

Web editing requires a feature service to provide the symbology and feature geometry for editable data. The feature service is just a map service with the Feature Access capability enabled. This capability allows the map service to expose feature geometries and their symbols in a way that is easy for web editing applications to use and update.

Before you build a web editing application, you need to create a feature service exposing the layers to be edited. This involves setting up a map document and, optionally, defining some templates for editing. Templates allow you to preconfigure the symbology and attributes for some commonly-used feature types. For example, to prepare for editing roads, you might configure templates for Controlled Access Freeway, Other Divided Highway, State Highway, and Local Road. Templates are optional, but they make it easy for the end user of the application to create common features.

Once your map is finished, you need to publish it to ArcGIS Server with the Feature Access capability enabled. This creates REST URLs, or endpoints, to both a map service and a feature service. You will use these URLs to reference the services in your application.

Feature services are easily accessible in the ArcGIS API for Silverlight using a feature layer. Feature layers do a variety of things and can reference either feature layers in a map service or feature services; however, when you use a feature layer for editing purposes, you need to reference a feature service.

While editing, your application tells the feature layer which attributes have changed and, if applicable, how the geometry has changed. The feature layer also displays the updated features after editing. Edits can be applied immediately, or you can explicitly commit edits at your discretion.

Geometry service

The ArcGIS Server geometry service helps perform common editing operations such as creating, cutting, and reshaping geographic features. Before you use the Editor Widget, you need to create a geometry service on your ArcGIS Server or use a public ArcGIS Server geometry service. When you create the Editor Widget, you must provide the URL to the geometry service. The control uses the service behind the scenes. If features are autoselected, geometry operations can be used on editable feature layers. Otherwise, features must be explicitly selected before geometry operations are enabled in the control.

Custom editing solutions

If you decide not to use the Editor Widget, you can still use the Editor component and a set of edit commands to add, edit, and select features or methods and classes related to the feature layer. While an "edit toolbar" is not provided out of the box, you can use a set of commands within the context of a toolbar. Commanding controls, such as ButtonBase and Hyperlink, in the Silverlight platform, define their Command and CommandParameter properties using a set of Editor commands. The Editor maintains the following set of commands (implement ICommand):

  • Add—Draws and adds new graphics.
  • CancelActive—Cancels the active command on the map.
  • ClearSelection—Unselects all graphics.
  • Cut—Uses a geometry service to cut graphics along a user-defined line.
  • DeleteSelected—Deletes selected graphics. If graphics are associated with an editable feature layer, features are deleted from the database.
  • EditVertices—Edits the vertices of any graphic clicked by the user.
  • Move—Click and drag a graphic to a new location.
  • Reshape—Uses a geometry service to reshape graphics with a user-defined line.
  • Save—Commits unsaved edits in all feature layers.
  • Union—Uses a geometry service to union graphics selected by the user.
See the Editor class in ESRI.ArcGIS.Client assembly/namespace in the library reference for additional information about the Editor.

Designing your editing experience

When you build a web editing application, it's important to think about who will use the application and what they will need to do. You should provide your users no more and no less than the tools they need. In most situations, you can design an appropriate editing experience for your users through a combination of editing controls and tools included with this API. Keep in mind that although the API includes a comprehensive Editor Widget to help you get started, this particular widget may not be the best fit for your scenario.

Consider the following approaches for designing a web editing application. Each approach has its own merits and type of applications for which it is most appropriate.

Feature sketching

In this type of application, field analysts need to sketch simple events on the map (for example, bird sightings). The geographic precision of the edits is not as important as the event's attributes and the fact that the event happened. In this type of application, you can use a Template Picker to limit the types of items users can sketch. The Feature Data Form is also useful, either in a side panel or in an info window that appears when the feature is clicked. Options for splitting and merging features, adding a point at an X/Y location, snapping, or uploading feature attachments can clutter the application and should be avoided unless absolutely needed.

Attribute-only editing

Some editing applications include a mapping component but do not require changing feature geometry. For example, you may want to create an application allowing any office employee to edit the attributes of a parcel feature in your database. You want to prevent them from editing the geometry, leaving that task to your GIS analysts. In this scenario, you can include a map in your application, but expose editing only through the Feature Data Form or Feature Data Grid. A simple map click on a parcel displays the attributes to be edited. You do not need to include any buttons or controls for creating, deleting, or reshaping features.

Editing adjacent polygons

In some situations, you want users to be able to reshape existing polygons or edit their attributes without causing gaps or overlaps between features. The features might represent sales districts within a region or voter precincts within a county. Your editors might not be GIS professionals who understand concepts such as topological relationships, vertices, or snapping. You need to provide them with a subset of tools such as Union, Cut, and Reshape that modify features while preserving topological integrity. Tools for adding or deleting features and editing attributes is optional in this type of application.

Citizen participation or geo-wiki

In this type of application, citizens can be the editors and report problems to a government organization by placing points on the map and including ancillary information, such as photographs or a brief description. Users of this type of application are usually unaware that they are editing GIS data. They are only allowed to add point features to the database, using a carefully selected set of incident types predefined in a Template Picker. Attribute editing might be allowed in a very limited degree so that citizens can describe the incidents.

In this type of application, you may have to code some security checks to ensure that users can only edit or delete their own incidents. You may also include logic to periodically clean out the database, or allow a subset of authenticated users to close or delete incidents.

Specialized field work

Some applications are designed for specific types of field work and a refined audience. Suppose you have many field analysts in charge of updating a streets database. When building them an application for field work, you can choose to allow creation and deletion of line features only. Snapping is enabled but only on the street network layer. The Template Picker makes it easy to denote which type of street is being created (unpaved road, paved minor road, arterial, and so on). Attribute editing is optional and can help analysts set other selected properties. However, you can limit the attributes available for editing to keep the application usable and preserve screen real estate.