Offline data

Offline data

What is offline data?

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 typeDownloaded 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 EditorVTPK + Item Resource Cache
    Offline enabled vector tile serviceVTPK
    Offline enabled image tile serviceTPK
  • 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:
  1. Reference an offline enabled service. The basemap styles service and custom basemap styles are always offline enabled.
  2. 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:

  1. Create a Geodatabase Sync Task referencing the feature service.

    ArcGIS Maps SDK for .NETArcGIS Maps SDK for .NETArcGIS Maps SDK for SwiftArcGIS Maps SDK for KotlinArcGIS 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
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    GeodatabaseSyncTask geodatabaseSyncTask = await GeodatabaseSyncTask.CreateAsync(featureServiceUrl);
    
  2. 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 SwiftArcGIS Maps SDK for KotlinArcGIS 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
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    GenerateGeodatabaseParameters gdbParams = await geodatabaseSyncTask.CreateDefaultGenerateGeodatabaseParametersAsync(areaOfInterest);
    
    GenerateGeodatabaseJob generateJob = geodatabaseSyncTask.GenerateGeodatabase(gdbParams, "path\\to\\file.geodatabase");
    
  3. 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 SwiftArcGIS Maps SDK for KotlinArcGIS 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
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    Geodatabase generateResult = await generateJob.GetResultAsync();
    

Access

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 SwiftArcGIS Maps SDK for KotlinArcGIS 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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
Geodatabase offlineGeodatabase = await Geodatabase.OpenAsync("path\\to\\file.geodatabase");

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.

Edit

You can edit offline data from a feature service if the source feature service allows editing. To learn more, see Editing offline data.

Synchronize

Offline data from a feature service can be synchronized with its source service.

You can choose whether to:

  • Upload edits from offline data to the source feature service.
  • Download edits from the source feature service to the offline data.
  • Both upload and download (bidirectional sync). This is the default.

To synchronize offline data with its source feature service, a network connection is required.

How to synchronize offline data

  1. Create an Geodatabase Sync Task referencing the source feature service for the offline data.

    ArcGIS Maps SDK for .NETArcGIS Maps SDK for .NETArcGIS Maps SDK for SwiftArcGIS Maps SDK for KotlinArcGIS 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
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    Uri serviceUrl = offlineGeodatabase.Source;
    
    GeodatabaseSyncTask gdbSyncTask = await GeodatabaseSyncTask.CreateAsync(serviceUrl);
    
  2. Use the Geodatabase Sync Task to create a Geodatabase Sync Job by providing the previously downloaded Geodatabase.

    ArcGIS Maps SDK for .NETArcGIS Maps SDK for .NETArcGIS Maps SDK for SwiftArcGIS Maps SDK for KotlinArcGIS 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
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    SyncGeodatabaseParameters offlineSyncParams = await gdbSyncTask.CreateDefaultSyncGeodatabaseParametersAsync(offlineGeodatabase);
    
    SyncGeodatabaseJob syncJob = gdbSyncTask.SyncGeodatabase(offlineSyncParams, offlineGeodatabase);
    
  3. Start the job. If it completes without errors, the offline data and feature service will be in sync.

    ArcGIS Maps SDK for .NETArcGIS Maps SDK for .NETArcGIS Maps SDK for SwiftArcGIS Maps SDK for KotlinArcGIS 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
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    IReadOnlyList<SyncLayerResult> syncResult = await syncJob.GetResultAsync();
    
    if (syncJob.Status != Esri.ArcGISRuntime.Tasks.JobStatus.Succeeded)
    {
        // Handle errors
    }
    

Synchronization conflicts

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:

  1. Create a Geodatabase from the downloaded geodatabase file.
  2. Load the Geodatabase.
  3. Read the Sync Enabled property of the Geodatabase. If this is false, no further action is needed.
  4. Get the feature service URL from the Geodatabase.
  5. Create a Geodatabase Sync Task with the feature service URL to reference the source feature service for the geodatabase.
  6. 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:

  1. Create an Export Vector Tiles Task referencing the hosted vector tile layer item.
  2. Get a set of default parameters to download the area of interest, specifying the largest scale content detail to include.
  3. Create an Export Vector Tiles Job.
  4. Start the job and wait for it to complete.
ArcGIS Maps SDK for .NETArcGIS Maps SDK for .NETArcGIS Maps SDK for SwiftArcGIS Maps SDK for KotlinArcGIS 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
var areaOfInterest = new Envelope(new MapPoint(-118.542587, 34.391663, SpatialReferences.Wgs84), 5, 5);
areaOfInterest = (Envelope)GeometryEngine.Project(areaOfInterest, SpatialReferences.WebMercator);

PortalItem hostedItem = await PortalItem.CreateAsync(await ArcGISPortal.CreateAsync(), "46a87c20f09e4fc48fa3c38081e0cae6");

ExportVectorTilesTask exportVectorTileCacheTask = await ExportVectorTilesTask.CreateAsync(hostedItem);

ExportVectorTilesParameters exportVectorTilesParams = await exportVectorTileCacheTask.CreateDefaultExportVectorTilesParametersAsync(
    areaOfInterest: areaOfInterest,
    maxScale: 100);

ExportVectorTilesJob exportJob = exportVectorTileCacheTask.ExportVectorTiles(
    parameters: exportVectorTilesParams,
    vectorTileCachePath: "path\\to\\something.vtpk",
    itemResourceCachePath: "path\\to\\cache\\dir");

ExportVectorTilesResult exportResult = await exportJob.GetResultAsync();

var offlineVectorTileLayer = new ArcGISVectorTiledLayer(
    vectorTileCache: exportResult.VectorTileCache,
    itemResourceCache: exportResult.ItemResourceCache
);

MainMapView.Map.Basemap = new Basemap(offlineVectorTileLayer);

Download offline data from a feature service

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:

  1. Create a Geodatabase Sync Task referencing the hosted feature layer item.
  2. Get a set of default parameters to download the area of interest, and modify them to not download attachments.
  3. Create a Generate Geodatabase Job.
  4. Start the job and wait for it to complete.
ArcGIS Maps SDK for .NETArcGIS Maps SDK for .NETArcGIS Maps SDK for SwiftArcGIS Maps SDK for KotlinArcGIS 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 changes
job.ProgressChanged += (o,e) => { };

Geodatabase generateResult = await job.GetResultAsync();

MainMapView.Map.OperationalLayers.AddRange(generateResult.GeodatabaseFeatureTables.Select(table => new FeatureLayer(table)));

MainMapView.SetViewpointGeometryAsync(areaOfInterest, 50);

Tutorials

Tools
APIs

API support

Offline mapsOffline dataData filesMobile packagesEditing offline dataSpatial analysis
ArcGIS Maps SDK for JavaScript1
ArcGIS Maps SDK for .NET
ArcGIS Maps SDK for Kotlin
ArcGIS Maps SDK for Swift
ArcGIS Maps SDK for Java
ArcGIS Maps SDK for Qt
ArcGIS API for Python2
ArcGIS REST JS2
Esri Leaflet
MapLibre GL JS
OpenLayers
Full supportPartial supportNo support
  • 1. Geometry engine
  • 2. Manage offline map areas

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.