Authoring feature services
The feature service authoring process involves setting up a map document to define the data and symbology that will be exposed by the service. If you plan to allow editing on the service, you can also define the editing environment.
Defining the data
The layers and tables that you add to the map document are exposed by the service. Some things about how the data is defined are common whether your data source is a geodatabase or a database. Those things are described below. In other cases, how you define the data depends on whether it is in a geodatabase or database. Those differences are described in the subsequent subsections. Supported geodatabase and database platforms include SQL Server, PostgreSQL, Oracle, Informix, and DB2.
The data must have a valid spatial reference defined for it. If it does not, you must specify one in ArcMap before the data can be published. If no spatial reference is defined, you cannot publish the data.
If you are planning to use the feature service for editing, it is recommended that you only add data to the map document that you want to edit. 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.
You can edit features that have z-values. For more information, 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 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 to edit using the feature service in ArcMap (see below), make sure to include only one layer per feature class when authoring the map document.
![Note Note](rsrc/note.png)
Virtual layers, such as route events, x,y events, and cadastral fabrics, are read-only through the feature service.
Enterprise or workgroup geodatabases
The following describe feature service data requirements that are specific to data stored in an enterprise or workgroup geodatabase:
- All data must be from a single geodatabase.
- All data must be registered with the geodatabase. For example, if your database contains an enterprise geodatabase, you cannot publish a spatial table from the database that is not registered with the geodatabase.
- Write permissions on the data are required if you plan to allow edits to the data. When using operating system authentication, these permissions must be granted to the ArcGIS Server account.
- Versioned and nonversioned geodatabase data is supported; however, versioning is required if you plan to edit nonsimple types (for example, network edges) with the service. Unless required, it is recommended that the data be nonversioned. Nonversioned data scales better for editing.
The following data types are not supported in feature services:
- Annotations
- Dimensions
- Group layers
- Layers and tables based on views
- Raster datasets
- Terrains
If these layers are present in your map document when you attempt to publish a map service with feature access enabled, you will encounter analyzer errors.
Layers that are part of nonsimple types, such as geometric networks, topologies, and network datasets, 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 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 or table is not included in the map document, the relationship is ignored by the feature service.
![Note Note](rsrc/note.png)
For attributed relationship classes, you must also include the relationship class table in the map document.
Preparing your geodatabase data for use while offline
To work with maps when you're offline, you can enable a Sync capability on the feature services you use in your map. For more information, see Preparing data for offline use.
![Note Note](rsrc/note.png)
ArcGIS clients and developer SDKs will progressively add support for the sync capability in feature services. The first clients to support working with maps while offline are the 10.2.2 versions of Collector for ArcGIS and ArcGIS Runtime SDKs.
Databases
The following describe feature service data requirements specific to data stored in a database:
- All data must be from a single database.
- Write permissions on the data are required if you plan to allow edits to the data. When using operating system authentication, these permissions must be granted to the ArcGIS Server account.
- When you add database data to ArcMap, a query layer is created. If you alter the query layer definition, be sure the query contains only one table, does not have duplicate columns, and does not include virtual or merged columns.
- The data that is published is determined by the query layer defined for the table in ArcMap. For example, tables that contain data types that are not supported by ArcGIS can be published, but the unsupported data types are not accessible through ArcGIS or the feature service. See Viewing database data in ArcGIS for information on how the query layer is initially defined when a database table is added to ArcMap.
- The table must contain a unique integer column maintained by the database. If you create tables and load the data to the database using ArcGIS for Desktop, a database-maintained unique integer ObjectID is added automatically. If you create data outside of ArcGIS, be sure to include a database-maintained unique integer column in the table. If such a column does not exist, you cannot publish a feature service. You can use the Add Incrementing ID Field geoprocessing tool to add a database-maintained integer column to your table if it is in an IBM DB2, Microsoft SQL Server, Oracle, or PostgreSQL database.
Setting up the map document
The next step after adding the data to the map document that you want to publish 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.
Setting up your map document is similar for both database and geodatabase data. However, if your map document contains geodatabase data, there is some extra functionality you can use that you will set up in your map before publishing. This functionality is described at the end of this section.
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. 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, a type is returned for each unique value in the renderer.
Feature services support simple, unique value, class break, and cartographic representation renderers. If an unsupported renderer is used, the service fails to start. The server log can be used in this case to determine which layers have renderers that are not supported.
![Note Note](rsrc/note.png)
Proportional symbols, as well as 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 converts them to a simple line symbol that best represents the original symbol. For example, a cartographic line symbol in the map document may be drawn as a simple solid line in a feature service client. If a line symbol is complex or has multiple layers, the feature service downgrades the line to best represent the original line symbol.
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 use cartographic representation renderers, the renderers are reported as unique value renderers when clients access the service through REST.
![Note Note](rsrc/note.png)
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 attribute's default values set accordingly. Feature services require that a template exist for each feature type. When you start an edit session or publish the service, a default template is created for each type.
Default templates are always used for database data. You can create customized templates for use with geodatabase data. See the Custom feature templates section for more information.
Field properties
Field properties set in ArcMap are 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, globalid, and editor tracking fields (geodatabase only), 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. If default values have not been defined, nulls are applied. If the field cannot store null values, the insert will fail.
Layer description and copyright information
Layer descriptions and credits (copyrights) specified in the map document are exposed for each layer in the feature service as a layer description and copyright information, respectively.
HTML pop-ups
Feature services support HTML pop-ups configured 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 set up HTML pop-ups in ArcMap, see Setting HTML pop-up properties for feature layers.
If you'll be working with your feature service on the web and you want pop-ups to be available, consider defining them in the ArcGIS.com map viewer instead. Alternatively, developers can use the client API itself, such as the ArcGIS API for JavaScript, to define pop-up styles.
Time support
Temporal data—data that represents a state in time—is supported and can be visualized through feature services. The time information is stored in 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 on the Time tab of the Layer Properties dialog box. 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 is 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.
![Note Note](rsrc/note.png)
Although you can publish separate layers that have different coordinate systems, all records in an individual table must use the same coordinate system.
Additional geodatabase functionality
If your data is stored in a geodatabase, you can take advantage of some additional functionality. You must set up this functionality prior to publishing a feature service.
Defining subtypes and attribute domains
If the data you publish is in a geodatabase, you can configure your datasets to use subtypes and attribute domains where appropriate to enhance the user experience of the feature service and prevent data entry errors. These provide ways of categorizing your data and ensuring that appropriate values are entered when the data is edited. Feature services can detect and use the subtypes and domains. For example, if you have a domain limiting the color of a fire hydrant to red, yellow, or blue, you see a drop-down list in the web application that allows you to only select one of those three colors.
Custom feature templates
Within ArcMap, you can 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. If you remove a template for a particular feature type, a default template will be created when you publish.
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 is 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 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.
Attachments
Feature services allow you to query and edit attachments. An attachment is a media file that is associated with a feature or object in a geodatabase. 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. When these datasets are added to a map document and published, clients can query, insert, and delete the attachments through the feature service.
There are limits imposed on the size and file types you can attach to a feature service. To learn more about these limits and how to modify attachment settings, see Uploads in the ArcGIS REST API Help.
For more information about how to configure a dataset to support attachments, see Enabling attachments on a feature class.
Example workflow: Bird sighting feature service
The following section walks 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.
![Note Note](rsrc/note.png)
The steps in this example are applicable to geodatabases and databases; however, feature attachments and custom feature templates are not available in databases. You can skip over the content that discusses this functionality if the data you're working with is not stored in a geodatabase.
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 a geodatabase. To have attachments associated with this feature class, attachments have to be added in ArcCatalog or the Catalog window in ArcMap. To do this, connect to the database, right-click the feature class, and choose Manage > 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.
![Note Note](rsrc/note.png)
Certain types of data require versioning to be edited in an enterprise geodatabase. This same requirement also applies to editing feature services. For more information, see A quick tour of versioning.
Defining the symbology
With the data set up, 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. 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.
|
|
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 is selected from the Esri symbol selector. The foreground and background colors are set differently for each type of sighting so 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 are 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. The Templates wizard appears, where you can create templates. Choose to create templates for all the different types of bird sightings. Once templates have been created, you can copy them 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 is 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 brings 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 surveys and Out of Season Bird Sightings that do not require follow-up surveys |
The template for endangered rare bird sightings has the sighting type set to Rare Bird Sighting and the description set to Endangered. The template for out-of-season rare bird sightings has the sighting type set to Rare Bird Sighting 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 default to Yes. A follow-up is not required for out-of-season rare bird sightings, so the Follow up attribute can be set to No.
Setting some of the attributes to default values in the templates simplifies the editing experience for end users because they have to only 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. After it has been published, end users can access the service through web clients or ArcGIS for Desktop for querying and editing.
For more information about publishing a feature service, see Publishing feature services.
Other example tutorials
If you need more guidance in how to set up and use a feature service, the following tutorials provide step-by-step examples of how to set up a map document, define the data, and define the symbology that will be exposed through a feature service to perform web editing. The tutorials vary depending if you've stored your data in an enterprise geodatabase or database:
Enterprise geodatabase
If your data is stored in an enterprise geodatabase, follow the enterprise geodatabase tutorials:
Tutorial: Performing web editing using data from an enterprise geodatabase
Tutorial: Performing web editing using replicated data from an enterprise geodatabase
Database
If your data is stored in a database, follow the database tutorial: