Prepare data for offline use
In this topic
- Data preparation
- Feature service preparation
- Output from downloading local copies of the data or synchronizing with the service
- Synchronous and asynchronous modes
- System information for synchronization processes
To work with a map even when you're offline, you can enable a sync capability on the feature services you use in your map. The sync capability has operations that allow clients to work with a local copy of the data. If the publisher chooses to allow it, clients can edit the local copy of the data and synchronize with the feature service when connectivity is available.
Note:
ArcGIS clients and developer SDKs will progressively add support for the sync capability in feature services, which was introduced in ArcGIS 10.2.1 for Server. The first clients to support working with maps while offline are the 10.2.2 versions of Collector for ArcGIS and ArcGIS Runtime SDKs. You cannot enable the sync capability on feature services published prior to ArcGIS 10.2.1 for Server.
Other clients can access the sync capability through the ArcGIS REST API.
Data preparation
To use the sync capability, all the data in the feature service must be from an enterprise geodatabase. Also, you must prepare the data so it can be used offline and, if required, synchronized through the feature service when you have connectivity.
The data you use in a sync-enabled feature service can be either nonversioned with archiving enabled or, if your organization's data or workflows require it, the data can be versioned.
Be aware that the sync capability can only be enabled when all the data in the map is configured exactly the same; you cannot have a mix of versioned and nonversioned data.
Nonversioned data with archiving
You can use archive-enabled nonversioned data in a feature service that is enabled for sync functionality. When the data is nonversioned, clients always work with the current representation of the data. Back-office processes are not required for clients running offline to obtain the latest changes once they again have connectivity to the feature service.
Prepare nonversioned data as follows to participate in sync functionality:
- Enable archiving on the datasets.
- Include Global IDs on the datasets.
- Relationship classes and attachments must use a Global ID primary key. For more information, see the Attachments and relationship classes section of this topic.
For a detailed walk-through of this scenario, see Tutorial: Setting up feature service data for offline use.
You can publish feature services that reference nonversioned data from a 10.2 or later release enterprise geodatabase, take the data offline for editing, and synchronize changes with the enterprise geodatabase through the feature service.
Versioned data
If your organization requires any of the following, use versioned data:
- The data participates in geodatabase functionality that requires it to be versioned to allow editing. For example, if the feature class participates in a geometric network, the feature dataset must be versioned.
- Your organization has workflows in place that require the data to be versioned, such as having a quality assurance version of the data.
Prepare data as follows if you need to use versioning:
- Include Global IDs on the datasets.
- Register the datasets as versioned.
- Relationship classes and attachments must use a Global ID primary key. For more information, see the Attachments and relationship classes section of this topic.
You can publish feature services that reference versioned data from a 10.1 or later release enterprise geodatabase, take the data offline for editing, and synchronize changes with the enterprise geodatabase through the feature service.
See Offline maps and versioned data for more information.
Global IDs
The Global IDs you add to the datasets you take offline cannot be based on a custom field; they must explicitly use the Global ID field created by ArcGIS. To add Global IDs to your data, use the Add Global IDs geoprocessing tool or the Add Global ID command found on the feature class, feature dataset, and table context menus in the Catalog tree.
Attachments and relationship classes
If the data you want to use offline contains attachments or participates in a relationship class, the relationship between the tables or the table and the attachment must use either a Global ID column or user-managed field as the primary key. If the ObjectID column is the primary key, an error is returned when you download data for offline use. You can use the Migrate Relationship Class geoprocessing tool to convert ObjectID-based relationship classes and attachments to use Global ID fields as the primary key.
Using ArcGIS Server's managed database
If you enable the sync capability at the time that you publish to ArcGIS Server's managed database, no data preparation is required. The publishing process will set up the data to support the sync capability automatically. If you are not publishing to ArcGIS Server's managed database or you enable the sync capability after publishing to the managed database, you must prepare your geodatabase data as described in the previous sections.
Editor tracking
You can use editor tracking with data that is edited while offline. When you download data to the client for offline use, the existing values in the editor tracking fields are copied to the client along with the rest of the data. When working with the data offline, the date and time that features are created or edited are recorded in the create and edit date fields, respectively. These values are preserved when the data is synchronized with the service.
Note:
All date values must be in UTC format.
Offline data includes the name of the user who took the map offline. This is used with editor tracking as follows:
- For features that were created while offline, the creator name value is set to the user who took the map offline.
- For existing features that were edited while offline, the editor name value is set to the user who took the map offline. The creator name value for these features is not changed.
Either the person who took the map offline or an ArcGIS Server administrator can connect to the service and synchronize data.
Hosted feature services
If you are publishing feature services hosted on ArcGIS Online (hosted feature layers), the data is always nonversioned and is automatically prepared to use sync when you enable sync capabilities. This is done because publishers do not have access to the ArcGIS Online hosting server and, therefore, could not manually prepare the data to use sync capabilities.
When you publish hosted feature services to Portal for ArcGIS, the data is copied to the managed database of the portal's hosting server. This data is also always nonversioned. If your portal uses ArcGIS Data Store for the managed database of the hosting server, the data is automatically prepared to use sync when you enable sync capabilities. If you are not using ArcGIS Data Store for the managed database, you may need to alter the data manually to synchronize. For more information, see Enable a hosted feature service for offline mapping in the Portal for ArcGIS help.
Feature service preparation
When authoring a feature service, the publisher chooses options that define the edits that can be made through the service. The following sections describe how the options are applied when using maps offline.
Operations allowed (capabilities)
Feature service capabilities define the operations that are allowed when working with a feature service. There are two configurations supported for feature services that participate in offline map use:
- Read-only data—If clients will only query the data they download from the feature service to use while offline, set the Query and Sync capabilities on the feature service. With this configuration, the data cannot be edited while offline and synchronized back to the service.
- Editable data—If clients will edit the data when offline and synchronize changes with the feature service when they have connectivity, set the following capabilities on the feature service:
- Query
- Sync
- Any combination of Create, Delete, and Update
Once the feature service is created, publishers and administrators can choose to disable the sync capability. For example, a publisher or administrator might disable the sync capability on the service to prevent clients from synchronizing with the service while data maintenance tasks are in progress, such as rebuilding indexes.
Short transactions
If you are using nonversioned data, avoid keeping edit transactions open for long periods of time when editing a sync-enabled feature service. For example, if you plan to edit nonversioned data in ArcMap that is also used for sync by a feature service, make sure to save edits periodically and stop editing when the edit session is complete.
Geometry updates and true curves
The feature service can be configured to allow geometry updates and edits to data with true curves. These settings are enforced when edits are synchronized from the client to the service. Any edits the client made that violate the geometry updates and true curve settings of the feature service will not be synchronized with the service.
Ownership-based access control
You can control feature access using ownership-based access control. Any edits the client made that violate the ownership-based access control rules will not be synchronized with the service. The login used to synchronize the edits is considered the editor in this case.
Either the person who took the map offline or an ArcGIS Server administrator can connect to the service and synchronize data. When an administrator synchronizes edits made while offline, ownership-based access control is based on the named user who took the map offline, not the administrator.
Invisible and read-only fields
When you author a feature service, you can choose to make some fields read-only or not visible to the feature service. Fields that are not visible to the feature service will not be downloaded to the client for offline use. Read-only fields will remain read-only in the downloaded data.
Note:
When the sync capability is enabled, subtypes must be visible; otherwise, your map cannot be taken offline.
Map layers
A feature service published to ArcGIS for Server or Portal for ArcGIS that contains two layers based on the same feature class cannot be taken offline, edited, and synchronized.
For example, if you add your roads feature class to your map to display all roads, add the same roads feature class and set a definition query on it to display roads that are under construction, and publish a feature service from the map, you cannot take the feature service offline for editing and synchronize your changes when you are online.
Sync options
When an editable feature service contains versioned data, a version is created for individual clients when a map is taken offline. When a client synchronizes changes to the feature service, edits are applied to this version. The geodatabase administrator must perform reconcile and post processes to share the edits with others.
When a read-only feature service (only Query and Sync capabilities enabled) contains versioned data, no version is created. When a client sychronizes with the published version, changes to the published feature service are automatically available in the client.
By default, a version is created every time someone takes a map offline. However, the ArcGIS Server administrator or feature service owner can configure the feature service so a version is created for each login.
For example, if five different field workers take a map offline, five versions are generated. Each version is specific to an individual login, and the version name is based on the login name and the service name (for example, Joe_ValveFS). If Joe takes the map offline multiple times (for example, from more than one device), the same version is used when Joe syncs from each device. Thus one device has access to edits from the other device. However, new offline maps will only be as up-to-date as the last time Joe's version was reconciled. A version will remain as long as the person who took the map offline still has the offline map.
Note:
The names of versions created for synchronization are limited to 30 bytes.
Follow these steps to set this sync option on an ArcGIS for Server service:
- Log in to ArcGIS Server Manager as the service owner or ArcGIS Server administrator.
- Be sure Services is selected at the top of ArcGIS Server Manager.
- Browse to your feature service and click the service's name to open information on that service.
- Click Capabilities.
- Select Feature Access.
- Under Properties, click Advanced Options.
The Feature Service Advanced Options dialog box opens.
- Under Sync, choose to Create a version for each Downloaded Map or User.
- Click OK to close the Feature Service Advanced Options dialog box.
- Click Save and Restart to apply the setting changes to your feature service.
The service will be unavailable while it is restarting.
Output from downloading local copies of the data or synchronizing with the service
When you download data to a local client, a file that contains the data is created in the ArcGIS Server output directory, and your client downloads that file. By default, any files that have not been accessed by any process for more than 10 minutes are removed from the output directory. If you expect more than 10 minutes will elapse before the client starts downloading the file, you can create another output directory with a longer cleanup time and use this output directory for your feature services. Alternatively, you can increase the cleanup time of the default output directory; however, this affects all services using the default output directory.
Synchronous and asynchronous modes
The sync operations that download local copies of the data or synchronize changes to the service can be run in synchronous or asynchronous mode. When using synchronous mode, the processing is done by the service; therefore, service settings such as the minimum and maximum number of instances used, timeout intervals, and recycling intervals apply. When using the asynchronous mode, the processing is done by the SyncTools geoprocessing service that comes preconfigured with ArcGIS Server; therefore, the settings for the SyncTools geoprocessing service apply.
System information for synchronization processes
When data is downloaded for offline map use or changes are synchronized back to the service, information about these processes is stored in the system tables of the enterprise geodatabase that the feature service is using for its source data. The feature service's replicas resource lists metadata for the feature service. If the service is secured, only metadata associated with the logged in user or anonymous user is listed. Geodata services also include a replicas resource, which lists metadata for all feature services that reference the geodatabase. Administrators can use geodata services for tasks such as listing metadata per service or removing metadata for feature services that have been removed.