Authoring feature services

The authoring process involves setting up a map document to define the data and symbology that will be exposed by the service. If you plan on editing, you can also define the editing environment.

Defining the data

The layers and tables that you add to the map document will be exposed by the service. The following describes feature service data requirements:

NoteNote:
The following data types are not supported in feature services; annotation, dimensions, terrains, raster datasets, attributed relationship classes and many-to-many relationship classes. If these layers are present in a map service with feature access enabled, the service will publish but these data types will be ignored by the feature service.

Layers that are part of nonsimple types, such as geometric networks and topologies, are supported, but the types themselves are not returned by the service. For example, you can query layers that are part of a topology, but you cannot query the topology layer itself.

Feature services also allow queries on related data. For example, a published map document can have layers and tables that are related through geodatabase relationship classes. In this case, the feature service allows queries on a layer to return objects from the related layer or table. Note that to support queries that return related objects, both the table and the layer involved in the relationship class must be in the published map document. If either the origin or destination layer and/or table is not included in the map document, the relationship is ignored by the feature service.

If you are planning on using the feature service for editing, it is recommended that you only add data to the map document that you want to edit (the operational layers). Data that you don't want to edit, such as basemap layers, should be published in a different service. For more information about planning your operational and basemap services, see Map service planning. Another alternative is to use an ArcGIS Online service that can be used as the basemap. For more information on designing a map to overlay online maps and services, see Designing a map to overlay ArcGIS Online, Google Maps, and Bing Maps.

It is also important to note that there are some layer types that have a limited editing experience in feature services. If a layer has z-values, by default the features cannot be edited through a feature service. However, features with z-values can be edited through a feature service by enabling this capability in the feature service's properties once the service has been created. For more information about how to editing features with z-values through a feature service see: Editing features with z-values in feature services

If you have data that has m-values, these features can be deleted, new features can be inserted and the attributes of existing features can be edited, but the geometry cannot be edited. All new features will have their m-values set to NaN when inserted through the REST and SOAP endpoints. If features with m-values are edited through the feature service in ArcMap with the local editing commands, all editing operations are supported.

Also, if you plan on editing using the feature service in ArcGIS Desktop (see below), make sure to include only one layer per feature class when authoring the map document.

NoteNote:
Virtual layers such as route events, XY events and cadastral fabrics are read-only through the feature service.

Setting up the map document

The next step after adding the data that you want to publish to the map document is to set properties on the layers and tables. These properties define how the data will appear and what the client will be able to do with the data.

Defining the symbology

A feature service allows you to query features and also get the features' symbology. Clients can use this information to draw the features with a symbology that is consistent with what is defined on the service.

The symbols returned by the service are based on the symbology of the layers in the ArcMap document (.mxd). Each symbol in each layer is referred to as a type. For example, a layer symbolized with a simple renderer (one symbol) has one type. If a unique value renderer is used, there will be a type returned for each unique value in the renderer.

Feature services support a subset of ArcMap renderers. If an unsupported renderer is used, the service will fail to start. The server log can be used in this case to determine which layers have renderers that are not supported.

The supported rendering types are as follows:

NoteNote:
Unique Value renderers based on multiple fields are not supported by feature services.

Most symbol types can be used with a feature service; however, in some cases, the symbols may be downgraded.

For line layers, simple line symbols are supported. If other symbols are used, the feature service downgrades them to simple line symbols. For example, a cartographic line symbol in the map document may be drawn as a simple solid line in a feature service client. Also, if a line symbol has multiple layers, the feature service considers only the top layer.

For polygon layers, simple fill and picture fill symbols are supported. If other symbols are used, the feature service downgrades them to simple fill symbols. For multilayer fill symbols, the feature service only considers the top layer. Also, a fill symbol's outline symbol has the same level of support as described for line layers above.

For point layers, simple marker and picture marker symbols are supported. If other symbols are used, the feature service downgrades them to picture marker symbols. Multilayer marker symbols are also downgraded to picture marker symbols where the layers are merged into a single layer. Mask properties, where a halo can be set for a marker symbol, are not supported.

When a map service with feature access is started, the symbols are checked and downgraded if needed. In cases where a downgrade is required, a warning is added to the server log to describe which symbols were downgraded.

It is also important to note that if you have layers in your map document that are symbolized with cartographic representations, those symbols will not be available through the feature service, instead default symbols will be assigned.

NoteNote:
It is recommended that you use RGB colors in the symbols; otherwise, minor changes may occur when the colors are converted to the RGB color format.

Defining the feature templates

Inserting new features through a feature service is accomplished using the feature templates from the map document. A template allows you to digitize a new feature and have the attributes set appropriately by default. If templates do not already exist, a default template is created per type when you start an edit session or publish the service. Within ArcMap, you can also create new templates or modify existing templates to customize the editing experience through the feature service. This includes setting a default construction tool which is used to create that type of feature. There are different types of construction tools available depending on the type of feature the template will create. For example if you have a line template you can only select tools that can be used to create line features. The construction tool saved with the templates will be available through the feature service. The only exception is the point tool called 'Point at end of line', which is not supported by feature services. For more information about templates see: Setting feature template properties

When the map document is saved, the templates are saved with the layers in the map. When the map document is published, these templates are available for the feature service clients.Once the layers, types, and templates are defined in your map document, you are ready to publish the service. The Publishing feature services section describes how to publish a feature service.

Field properties

Field properties set in ArcMap will be exposed through the feature service; this includes field aliases, field visibility and a field's read-only property. Read-only fields include system managed fields such as objectid and globalid as well as fields set to be read-only in the map document. When applying an update, if a value is set for a read-only field the feature service ignores the value. When applying an insert, default values are applied for read-only and invisible fields. (Note: If default values have not been defined Nulls are applied.)

Layer description and copyright information

Layer descriptions and credits (copyright) specified in the map document will also be exposed for each layer in the feature service as a layer description and copyright information.

Attachments

Feature services also allow you to query and edit attachments. An attachment is a media file that is associated with a feature or object. For example, with attachments, photographs and videos can be added to a bird sighting and viewed when the sighting point is clicked. To use this feature, datasets within a geodatabase must first be configured to support attachments. For more information, see Enabling attachments on a feature class. When these datasets are added to a map document and published, clients can query, insert, and delete the attachments through the feature service.

Html popups

Feature services also support HTML pop-ups setup in ArcMap. HTML pop-ups are a powerful and easy way to share HTML formatted information about features. They work much like the Identify tool, except that the information display can be customized HTML. For more information about how to setup HTML pop-ups in ArcMap see: Setting HTML pop-up properties for feature layers

Time support

Temporal data is supported and can be visualized through feature services. Temporal data is data that represents a state in time. The time information is stored in a single or multiple attribute fields and can be used to visualize data at particular times or in time intervals. Temporal data can be exposed through the feature service by enabling time in the layer's properties Time tab. For more information about how to enable time on a dataset see: Enabling time on your data

Coordinate systems

Feature services support cases where layers in the map document have different coordinate systems. Coordinate system translations are performed if needed when using the feature service. For example, if a client inserts a feature through a feature service using a coordinate system that is different from the coordinate system of the layer, it will be converted to the layer's coordinate system before being stored. Spatial queries involving geometries are also converted to the layer's coordinate system before being applied in order to return the correct results.

Geographic (datum) transformations are also used if needed. For example, if the layer is stored in NAD27 and a feature is inserted through the service with a coordinate system of WGS 1984, a WGS 1984 to NAD27 datum transformation is performed before the feature is stored. You can control the transformation method by setting up transformations in the data frame properties of the map document before publishing. A default transformation is performed if one is not defined in the map.

Example workflow

Bird sighting feature service

The following section will walk you through an example of how to set up a map document, define the data, and define the symbology that will be exposed through a bird sighting feature service. The feature service will allow the birding community to post their bird sightings directly on the map and attach media files such as photographs, audio files, and video files to the specific observation points.

Defining the data

The first step in the authoring of a feature service is defining the data that will be available through the service. In this example, you start with a feature class called Bird_Sightings in an ArcSDE geodatabase. To have attachments associated with this feature class, attachments have to be added in ArcCatalog. To do this, connect to ArcSDE, right-click the feature class, then choose Attachments and Create Attachments. This creates a table that will store the attachments and a relationship class that relates the feature class to the attachments table. For more information about how to add attachments to a feature class, see Enabling attachments on a feature class.

Bird Sightings feature class

In this case, the data is being left unversioned since it is not required to be versioned for this workflow.

Defining the symbology

With the data set up in an ArcSDE geodatabase, the next step is to add the data to ArcMap and define the symbology. The symbols returned by the feature service are based on the symbology of the layers in the ArcMap document (.mxd). Each symbol in each layer is referred to as a type. In this example, by default, the bird sightings layer is symbolized with a simple renderer (one symbol).

However, in this case, you want to symbolize the bird sighting layer based on the type of sighting. To do this, a unique renderer can be used. To change the way a layer is rendered, right-click the layer and choose properties. In the properties dialog box, click the Symbology tab and, under Categories, choose Unique values. You can then select the field that you want to use to symbolize the layer. In this case, there are three unique types of sightings (bird sighting, nest sighting, and rare bird sighting), so three types (one for each sighting type) will be returned by the service.

Setting up the symbology of the bird sightings layer.

Now that the renderer has been selected, the next step is to choose the symbols that will represent each sighting type. In this case, a bird symbol was selected from the ESRI symbol selector. The foreground and background colors were set differently for each type of sighting so that they can be easily distinguished in the feature service. When the map document is published, the symbols are converted to PNG graphics, which are returned to the client.

Character Marker symbols used to symbolize the different types of bird sightings.

Once the symbology is set up, the next step is to define the editing environment that will be available through the feature service.

Defining the editing environment

The goal of this feature service is to allow bird enthusiasts to enter bird sightings and all relevant information onto a map. Editing through a feature service is accomplished using the feature templates from the map document. If you do not create templates, a default template is created per type when you publish the service. However, you can also create new templates or modify existing templates to customize the editing experience.

In this example, you want to create templates for this feature service. To do this, right-click the feature class and choose Edit features, then Organize Feature Templates. Under Layers, select the layer and click New Templates. This will bring up the Templates wizard where you can create templates. Choose to create templates for all of the different types of bird sightings. Once templates have been created, you can copy templates to create additional templates.

For this feature service, you want to add an additional template for the rare bird sighting type. Rare bird sightings can be birds that are either in the area out of season or endangered. To create a copy of a template, select the template you want to copy and click Copy. In this case, a copy of the rare bird sighting template was created so that each can be customized to represent the two types of rare bird sightings. To customize a template, double-click it in the Organize Feature Template window. This will bring up the template properties, where you can edit the name of the template as well as the default field values.

Template Properties for the Endangered Bird Sightings that require follow up and out of season Bird Sightings that do not require follow up

The template for endangered rare bird sightings will have the sighting type set to rare birds and the description set to endangered. The template for out of season rare bird sightings will have the sighting type set to rare birds and the description set to out of season.

The rest of the attributes can also be set to appropriate default values within each template. In this case, endangered rare bird sightings require a follow-up survey, so the follow-up attribute can be set to Yes by default. A follow-up is not required for out of season rare bird sightings, so the follow-up attribute can be set to No.

By setting some of the attributes to default values in the templates, it simplifies the editing experience for end users because they simply have to select the type of feature and digitize it. Once the layers, types, and templates are defined in your map document, you are ready to publish the service. For more information about publishing a feature service, see Publishing feature services. After it has been published, end users can access the service through Web clients or ArcGIS Desktop for querying and editing.


3/6/2013