The layers and tables you add to a map are included in the feature service when you publish. You need to configure the data to meet the requirements of a feature service.
Some data definition requirements are common whether your data source is a geodatabase or a database. Common requirements are described in the next section. In other cases, how you define the data depends on whether it's in a geodatabase or database. The Enterprise or workgroup geodatabase-specific requirements and Database-specific requirements sections below describe those differences.
If you plan to take the feature service offline, additional data preparation is needed. See Prepare data for offline use for more information on those requirements.
Virtual layers, such as route events, x,y events, and parcel fabrics, are read-only through the feature service.
Requirements common to geodatabases and databases
The following requirements are true whether your source data is stored in a database, a workgroup geodatabase, or an enterprise geodatabase:
- Data you publish to the feature service must come from a single source geodatabase or database. You cannot publish data from more than one database connection in a single map.
- The data must have a valid spatial reference defined for it. If it does not, specify one in ArcMap or ArcGIS Pro before you publish. If no spatial reference is defined, you cannot publish the data.
- Layers that are based on views are not supported in feature services. You cannot edit views using ArcGIS clients; therefore, publishing feature services containing views is not supported, as feature services can be enabled for editing. To use data from a view for reference in a map or app, publish the view in a map service.
- The database account you stored with the database connection file you register with the GIS Server site must have the privileges necessary to access the data. If the feature service will remain read-only, the account only needs select access to the data. If you plan to use the feature service for editing, you must grant editing permissions on the data. If the database connection you register with the site uses operating system authentication, these permissions must be granted to the ArcGIS Server account.
- Esri recommends that the map you publish as an editable feature service only contain data you want to edit. Publish data that you don't want to edit, such as basemap layers, 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 basemap. For more information on designing a map to overlay online maps and services, see Designing a map to overlay ArcGIS Online, Google Maps, or Bing Maps.
- Do not define multiple layers for the same feature class in the map you publish as a feature service if people will be adding the feature service to ArcMap or ArcGIS Pro and editing it. For example, if you want to serve the same feature class with different symbology or different definition queries applied, create separate feature services; do not include these differently configured representations of the same feature class in the same feature service.
- If your data contains z-values and editors need to edit the feature service in clients that do not support adding z-values when editing feature geometry (such as Map Viewer in ArcGIS Online and ArcGIS Enterprise portals), configure the feature service to insert default z-values.
- If your data contains m-values and editors need to edit the feature service in clients that do not support adding m-values when editing feature geometry (such as Map Viewer in ArcGIS Online and ArcGIS Enterprise portals), configure the feature service to insert NaNs for the m-values.
ArcGIS Desktop clients support all editing operations (insert, delete, and update, including geometry updates) on features with m- and z-values even when you make a local copy of the feature service data to edit in ArcMap. You do not need to configure default z- and NaN m-values if editors will only edit the feature service in these clients.
Enterprise or workgroup geodatabase-specific requirements
The feature service requirements listed here are specific to data stored in an enterprise or workgroup geodatabase. Your data needs to meet the requirements described in the previous section, as well as those described in this section.
- You can publish tables or feature classes that are not registered with the geodatabase; however, publishing views is not supported.
- If you allow edits on the feature service and the feature service contains feature classes that participate in a geometric network, the feature class data must be in the same projection and coordinate reference system used by the editing client application. For example, if you plan to add the feature service to Map Viewer to edit, the data must be stored in WGS 1984 Web Mercator (Auxiliary Sphere). Changing the projection in ArcMap or an ArcGIS Pro map before you publish is not sufficient; the data must use the same projection and coordinate reference system as the editing client.
- Versioned (traditional and branch) and nonversioned geodatabase data is supported in feature services. Esri recommends that you use nonversioned data in feature services because it scales better for editing. There are some complex data types (for example, network edges), however, that must be versioned before you can edit them through a feature service.
- To edit branch version data, you must publish a feature layer from ArcGIS Pro that references your registered data. See Share branch versioned data in the ArcGIS Pro help for more information.
- You cannot publish a map service with feature access enabled from an ArcMap document or publish a feature layer that references registered data from ArcGIS Pro if any of the following layers are present in your map:
- Group layers
- Layers and tables based on views
- Query layers that contain virtual columns, where clauses, or joins
- You can include annotation layers in your map when you publish a feature layer that references registered data from ArcGIS Pro. You cannot include annotation layers if you publish a map service with feature access enabled from an ArcMap map document.
- Parcel fabrics are always read-only when accessed through a feature service.
- You can publish layers that are part of complex types, such as geometric networks, topologies, and network datasets, but the types themselves are not returned by the feature service. For example, you can query the layers that are part of a topology, but you cannot query the topology.
- Feature services allow queries on related data, but only if the relationship is defined through a geodatabase relationship class. If a published map document has a layer and table related through a geodatabase relationship class, the feature service allows queries on the layer to return objects from the related table. To support queries that return related objects, you must include the table and layer involved in the relationship class in the published map document. If either the origin or destination layer or table is not included in the map document, the feature service ignores the relationship.
For attributed relationship classes, include the relationship class table in the map document.
- To maintain a utility network, you must publish it as a feature layer from ArcGIS Pro. See Publishing and consuming services with the utility network in the ArcGIS Pro help for more information.
Prepare geodatabase data for use while offline
To work with maps when you're offline, enable a sync capability on the feature services you use in your map. For more information, see Prepare data for offline use.
ArcGIS clients and developer SDKs will progressively add support for the sync capability in feature services, which was introduced in ArcGIS 10.2.1. The first clients to support working with maps while offline are Collector for ArcGIS and ArcGIS Runtime SDKs. You cannot enable the sync capability on feature services published prior to ArcGIS 10.2.1.
Other clients can access the sync capability through the ArcGIS REST API.
The following describes feature service data requirements specific to data stored in a database. Your data must meet these requirements in addition to the requirements common to geodatabases and databases.
- When you add database data to a map in ArcMap or ArcGIS Pro, 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 joins, where clauses, or virtual or merged columns.
- The query layer that's defined for the table determines what data publishes. For example, tables containing data types that are not supported by ArcGIS can be published, but unsupported data types are not accessible through ArcGIS or the feature service. See View database data in ArcGIS for information on how the query layer is initially defined when you add a database table to the map.
- 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, a database-maintained unique integer ObjectID is added automatically. If you create data outside of ArcGIS, be sure to include a database-maintained, unique, not null 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's in an IBM Db2, Microsoft Azure SQL Database, Microsoft SQL Server, Oracle, or PostgreSQL database. For all other databases, use database management system tools or SQL to create the ID column.
- Supported database platforms from which you can publish feature services include Dameng, Db2 (on Linux, UNIX, or Windows), IBM Informix, Microsoft Azure SQL Database, Oracle, PostgreSQL, SAP HANA, SQL Server, and Teradata Data Warehouse Appliance.