Editing features

Feature layers, using the feature service introduced with ArcGIS Server 10, support editing geographic data using a mobile device. Since a phone application is a simple, familiar, and (optionally) free application, mobile 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.

With the ArcGIS Runtime SDK for Windows Phone, you can 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 mobile editing application, you have complete control over how simple or complex an editing experience you expose to your users.

Mobile editing requires some initial setup of a feature service, which exposes information about a layer's feature geometries and attributes. Also, geometry services are required to accomplish some editing tasks, such as union, cut, and reshape.

Editing capabilities

The ArcGIS Runtime SDK for Windows Phone 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 mobile 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 API can perform some data validation, other tasks, such as validating topologies, cannot be performed via services.

Editing GraphicsLayers vs. FeatureLayers

The main difference between editing a GraphicsLayer and editing a FeatureLayer is that with a Feature Layer, you have the ability to post the changes to the server. FeatureLayer inherits from GraphicsLayer, so it has all the capabilities of the GraphicsLayer and more.

A FeatureLayer is composed of a GraphicsLayer and a Query used to populate the GraphicsLayer. FeatureLayers have a Url property that sets the layer that gets queried. This provides the FeatureLayer with a connection back to the server and to the service to which it's associated. If your FeatureLayer is connected to an ArcGIS Server feature service, it's editable and capable of posting those edits back to the server. A GraphicsLayer, on the other hand, is always editable, but the edits are only local and can't be posted back to the server.

The editing framework

Editing with the ArcGIS Runtime SDK for Windows Phone is accomplished through an Editor resource. It 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. Using that resource and those services, you can build a custom editing solution.

Editor

You can use the Editor component and a set of edit commands to add, edit, and select features. 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 a clicked graphic.
  • Reshape—Uses a geometry service to reshape graphics with a user-defined line.
  • Save—Commits unsaved edits in all feature layers.
  • Select—Allows the selection of graphics.
  • Union—Uses a geometry service to union selected graphics.
NoteNote:

Cut, reshape, and union require the Editor to have a geometry service.

For additional information and examples of using the Editor, see Using the Editor and the library reference section for the Editor class, which is in the ESRI.ArcGIS.Client assembly and the namespace of the same name.

Feature service

Editing via a service 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 applications to use and update.

Before you build an 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 Runtime SDK for Windows Phone 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 feature layers in a feature service. Editing is not supported in map services.

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 cutting, reshaping, and combining geographic features. Editors that perform those operations must have a geometry service to use. You can either create a geometry service on your ArcGIS Server or use a public ArcGIS Server geometry service. When you create the Editor, you can provide the URL to the geometry service. The Editor 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.

Designing your editing experience

When you build an 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. Consider the following approaches for designing an 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 a feature sketching application, you can limit the types of items users can sketch. The attributes can be displayed and editable. 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 geographic information system (GIS) analysts. In this scenario, you can include a map in your application, but expose editing only on the attributes. 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 any gaps or overlaps between features. The features may 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 predefined incident types. Attribute editing might be allowed in a very limited degree so that citizens can describe the incidents.

In a citizen participation 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. It's 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.

6/21/2013