Preparing data for offline use

To work with maps 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 the connectivity is available.

注注:

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.

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. How you prepare the data depends on whether the local copy of the data will be editable or read only and, if the local copy of the data will be read only, whether you use versioned data in your feature service.

If clients will be editing data while offline and sychronizing their changes when they have connectivity, the feature service must contain nonversioned data. Nonversioned data must be prepared as follows to participate in sync functionality:

For a detailed walk-through of this scenario, see Tutorial: Setting up feature service data for offline use.

You can publish nonversioned data from a 10.2 or later release enterprise geodatabase, take the data offline for editing, and synchronize changes with the enterprise geodatabase.

If clients will only query the data they download, the data in the feature service can be either nonversioned or versioned. If the data is nonversioned, prepare it as described above. If the data is versioned, configure it as follows:

You can publish versioned data from any supported version of the enterprise geodatabase and take the data offline.

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 data with differing configurations. For example, if clients will edit the data and, therefore, the data will not be versioned, all the data in the map must have archiving enabled and include Global IDs. The Global IDs 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 perform a 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.

注注:

All date values must be in UTC format.

Since you are not connected to the server and do not have access to the server's user store when working offline, the editor and creator name values are populated when the data is synchronized with the service.

  • For features that were created while offline, the creator name value is set to the user that connects to the service to synchronize the data.
  • For existing features that were edited while offline, the editor name value is set to the user that connects to the service to synchronize the data. The creator name value for these features is not changed.

Hosted feature services

If you are publishing feature services hosted on ArcGIS Online, the data that 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 services to Portal for ArcGIS, you must alter the data manually. For more information, see Enabling 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, data cannot be 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 CREATE, DELETE, QUERY, SYNC, and UPDATE capabilities on the feature service. Note that you must grant all of the editing capabilities.

Any other configurations will return an error when you download or synchronize the data.

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, such as rebuilding indexes, is in progress.

Short transactions

Avoid keeping edit transactions open for long periods of time when editing a sync-enabled feature service. For example, if you plan to edit 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.

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.

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 either a 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.

Clients access the synch capability through the ArcGIS REST API.

7/11/2014