Offline data is data that is generated and downloaded from a data service, or from the basemap styles service.
You can use offline data to build applications that:
Support disaster recovery operations when infrastructure has been damaged.
Enable mobile workers to collect and edit data.
Provide current, detailed maps to large workforces.
Display offline vector tile or image tile basemap layers.
How offline data works
To use offline data, you start with a reference to a service. The following services can be used to generate offline data:
The basemap styles service (including default basemap styles and custom basemap styles created using the Vector Tile Style Editor).
A feature service that has been offline enabled (including related records and attachments).
A vector tile service that has been offline enabled.
An image tile service that has been offline enabled.
Offline data for a requested geographic area is generated by the service and downloaded to a device. It can then be used without a network connection.
There are two types of offline data:
Tile data, created from one of the following service types and downloaded as a read-only package of static tiles. Depending on the type of service, tiles will be downloaded as vector tiles or image tiles.:
Source tile service type
Downloaded files
Basemap styles service (vector basemap layer)
VTPK + Item Resource Cache
Basemap styles service (image basemap layer)
TPK
Custom basemap style created with the Vector Tile Style Editor
VTPK + Item Resource Cache
Offline enabled vector tile service
VTPK
Offline enabled image tile service
TPK
Feature data, created from a feature service. The offline data is downloaded as a geodatabase file that can contain data for feature layers, non-spatial tables, and attachments. This data can be created, updated, or deleted according to the capabilities of the source feature service. Offline data edits can be synchronized with the source feature service whenever a network connection is available. To support offline data, the feature service must be sync enabled.
The typical steps to download offline data are:
Reference an offline enabled service. The basemap styles service and custom basemap styles are always offline enabled.
Download an area of the service.
Download
Use a reference to an offline enabled service and request offline data for a geographic area. The service will generate offline data which you can then download to your device.
You specify where to store downloaded offline data on the local device. Offline data remains on the device until you explicitly delete it from the device's file system.
Depending on the type of service, offline data is downloaded as feature data, vector tiles, or image tiles:
How to download offline data
Offline data is downloaded from a feature service as a geodatabase file.
The steps to download offline data from a feature service are:
Create a Geodatabase Sync Task referencing the feature service.
ArcGIS Maps SDK for .NETArcGIS Maps SDK for .NETArcGIS Maps SDK for JavaArcGIS Maps SDK for Qt (C++)ArcGIS Maps SDK for Qt (QML)
Use the Geodatabase Sync Task to create a Generate Geodatabase Job specifying the requested geographic area, and the download location for the geodatabase file that will be created.
ArcGIS Maps SDK for .NETArcGIS Maps SDK for .NETArcGIS Maps SDK for JavaArcGIS Maps SDK for Qt (C++)ArcGIS Maps SDK for Qt (QML)
Start the job and wait for it to complete, returning a ready to use Geodatabase that references the downloaded geodatabase file. Use this to access Geodatabase Feature Tables which can be queried and edited. You can use a Geodatabase Feature Table to create an Feature Layer, which can be added to a map.
ArcGIS Maps SDK for .NETArcGIS Maps SDK for .NETArcGIS Maps SDK for JavaArcGIS Maps SDK for Qt (C++)ArcGIS Maps SDK for Qt (QML)
Offline data is downloaded from a vector tile service or the basemap styles service as a vector tile package (VTPK) and typically an item resource cache.
Most default basemap styles and all custom basemap styles are downloaded as a vector tile package and an item resource cache.
The following default basemap styles cannot be downloaded as a vector tile package, and are downloaded as an image tile package:
ArcGIS:Imagery
ArcGIS:Imagery:Standard
ArcGIS:Hillshade:*
The steps to download offline data as a vector tile package (VTPK) are:
Create an Export Vector Tiles Task referencing the vector tile service or basemap styles service.
ArcGIS Maps SDK for .NETArcGIS Maps SDK for .NETArcGIS Maps SDK for JavaArcGIS Maps SDK for Qt (C++)ArcGIS Maps SDK for Qt (QML)
Use the Export Vector Tiles Task to create an Export Vector Tiles Job specifying the requested geographic area, and the download location for both the VTPK and the item resource cache that will be created. When downloading vector tiles from the basemap styles service, by default the item resource cache will include a full set of fonts for multiple languages. Applications that only need Latin fonts can opt-in to downloading a smaller set of fonts. This typically reduces the size of the downloaded fonts by about 80MB.
ArcGIS Maps SDK for .NETArcGIS Maps SDK for .NETArcGIS Maps SDK for JavaArcGIS Maps SDK for Qt (C++)ArcGIS Maps SDK for Qt (QML)
Start the job and wait for it to complete, returning a ready to use Vector Tile Cache that references the downloaded VTPK file and an Item Resource Cache that references the downloaded item resource cache. Use these to create an ArcGIS Vector Tiled Layer which can be added to a map.
ArcGIS Maps SDK for .NETArcGIS Maps SDK for .NETArcGIS Maps SDK for JavaArcGIS Maps SDK for Qt (C++)ArcGIS Maps SDK for Qt (QML)
Use the Export Tile Cache Task to create an Export Tile Cache Job specifying the requested geographic area, minimum and maximum scales to include image tiles, and the download location for the tile package that will be created. The minimum scale is particularly important as the number of image tiles that are included goes up exponentially as you zoom further into the map, increasing the size of the offline data TPK and the time it takes to generate it.
ArcGIS Maps SDK for .NETArcGIS Maps SDK for .NETArcGIS Maps SDK for JavaArcGIS Maps SDK for Qt (C++)ArcGIS Maps SDK for Qt (QML)
Start the job and wait for it to complete, returning a ready to use Tile Cache that references the downloaded TPK file. Use this to create an ArcGIS Tiled Layer which can be added to a map.
ArcGIS Maps SDK for .NETArcGIS Maps SDK for .NETArcGIS Maps SDK for JavaArcGIS Maps SDK for Qt (C++)ArcGIS Maps SDK for Qt (QML)
When you first download offline data the ArcGIS Maps SDKs for Native Apps provides you with a ready-to-use API reference to the offline data. To access previously downloaded offline data, you must create this API reference directly.
How to access offline data
Access previously downloaded offline data from a feature service by creating a Geodatabase from the downloaded geodatabase file:
ArcGIS Maps SDK for .NETArcGIS Maps SDK for .NETArcGIS Maps SDK for JavaArcGIS Maps SDK for Qt (C++)ArcGIS Maps SDK for Qt (QML)
Use the Geodatabase to create Geodatabase Feature Tables which can be queried and edited. A Geodatabase Feature Table can be used to create a Feature Layer which can be added to a map.
The steps to access previously downloaded offline data from a VTPK are:
Create a Vector Tile Cache from the downloaded VTPK file.
Optionally create an Item Resource Cache from the downloaded item resource cache folder.
ArcGIS Maps SDK for .NETArcGIS Maps SDK for .NETArcGIS Maps SDK for JavaArcGIS Maps SDK for Qt (C++)ArcGIS Maps SDK for Qt (QML)
Start the job. If it completes without errors, the offline data and feature service will be in sync.
Synchronization errors typically occur because of network connectivity issues during the sync process. The synchronization mechanism is robust to these types of errors, however, and they can be resolved by synchronizing again when a reliable network connection becomes available.
If you encounter a synchronization error, you can safely continue to view and edit the offline data until you are able to synchronize again.
ArcGIS Maps SDK for .NETArcGIS Maps SDK for .NETArcGIS Maps SDK for JavaArcGIS Maps SDK for Qt (C++)ArcGIS Maps SDK for Qt (QML)
If there are attribute or geometry level conflicts on a feature during synchronization, the most recently synchronized edit will be applied. For example, if both user A and user B edit the same feature while offline, if user A synchronizes their edits first, then user B synchronizes their edits, the updated feature will represent the edits made by user B.
Unregister
When you download offline data from a feature service, the offline data is registered with the feature service. This allows the feature service to track edits and compare its state with the offline data, and enables synchronizing the offline data with the feature service. When the offline data is no longer needed, you should unregister it to clean up the tracking metadata stored on the feature service.
How to unregister downloaded offline data from a feature service
Offline data from a feature service is downloaded as a geodatabase file. The steps to unregister it are:
Create a Geodatabase from the downloaded geodatabase file.
Load the Geodatabase.
Read the Sync Enabled property of the Geodatabase. If this is false, no further action is needed.
Get the feature service URL from the Geodatabase.
Create a Geodatabase Sync Task with the feature service URL to reference the source feature service for the geodatabase.
Use the Geodatabase Sync Task to unregister the geodatabase from the source feature service.
Code examples
Download a vector tile basemap layer
Use the Export Vector Tile Task to download a geographic area of a hosted vector tile layer with a custom style.
Create and start an Export Vector Tiles Job to generate and download the tiles and custom style. When the job completes, you will receive a result object containing a reference to the downloaded vector tile package (VTPK) of tiles, and the item resource cache for the custom style. You can use these to create a Vector Tile Layer, and set that as the basemap of the Map being displayed in a Map View:
Create an Export Vector Tiles Task referencing the hosted vector tile layer item.
Get a set of default parameters to download the area of interest, specifying the largest scale content detail to include.
Create an Export Vector Tiles Job.
Start the job and wait for it to complete.
ArcGIS Maps SDK for .NETArcGIS Maps SDK for .NETArcGIS Maps SDK for JavaArcGIS Maps SDK for Qt (C++)ArcGIS Maps SDK for Qt (QML)
Use the Geodatabase Sync Task to download a geographic area of a hosted feature layer.
Create and start a Generate Geodatabase Job to generate and download a geodatabase file of offline data. When the job completes, you will receive a Geodatabase object referencing the downloaded geodatabase file. You can access tables of feature data to create Feature Layers and add them to the Map being displayed in a Map View:
Create a Geodatabase Sync Task referencing the hosted feature layer item.
Get a set of default parameters to download the area of interest, and modify them to not download attachments.
Create a Generate Geodatabase Job.
Start the job and wait for it to complete.
ArcGIS Maps SDK for .NETArcGIS Maps SDK for .NETArcGIS Maps SDK for JavaArcGIS Maps SDK for Qt (C++)ArcGIS Maps SDK for Qt (QML)
Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
MainMapView.Map = new Map(BasemapStyle.ArcGISStreets);
var areaOfInterest = new Esri.ArcGISRuntime.Geometry.Polygon(new [] {
new MapPoint(-88.153245, 41.778064, SpatialReferences.Wgs84),
new MapPoint(-88.146708, 41.778870, SpatialReferences.Wgs84),
new MapPoint(-88.145878, 41.769764, SpatialReferences.Wgs84),
new MapPoint(-88.153431, 41.770330, SpatialReferences.Wgs84)
});
var featureServiceUri = new Uri("https://services2.arcgis.com/ZQgQTuoyBrtmoGdP/arcgis/rest/services/WaterDistributionNetwork/FeatureServer");
GeodatabaseSyncTask geodatabaseSyncTask = await GeodatabaseSyncTask.CreateAsync(featureServiceUri);
GenerateGeodatabaseParameters gdbGenerateParameters
= await geodatabaseSyncTask.CreateDefaultGenerateGeodatabaseParametersAsync(areaOfInterest.Extent);
gdbGenerateParameters.ReturnAttachments = false;
GenerateGeodatabaseJob job = geodatabaseSyncTask.GenerateGeodatabase(gdbGenerateParameters, "path\\to\\file.geodatabase");
// Optionally listen for progress changesjob.ProgressChanged += (o,e) => { };
Geodatabase generateResult = await job.GetResultAsync();
MainMapView.Map.OperationalLayers.AddRange(generateResult.GeodatabaseFeatureTables.Select(table => new FeatureLayer(table)));
MainMapView.SetViewpointGeometryAsync(areaOfInterest, 50);