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 layer 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 layer 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 layer service (vector basemap layer)VTPK + Item Resource Cache
    Basemap layer 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 layer 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

Feature serviceVector tile serviceImage tile service

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 .NET APIArcGIS Android APIArcGIS iOS APIArcGIS Java APIArcGIS Qt API (C++)ArcGIS Qt API (QML)
                                                                                               
    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
    // test data for convenience only
    Uri featureServiceUrl = new Uri("https://services2.arcgis.com/ZQgQTuoyBrtmoGdP/arcgis/rest/services/US_Bridges/FeatureServer");
    Envelope areaOfInterest = new Envelope(new MapPoint(-118.542587, 34.391663, SpatialReferences.Wgs84), 1, 1);
    areaOfInterest = (Envelope)GeometryEngine.Project(areaOfInterest, SpatialReferences.WebMercator);
    PortalItem hostedItem = await PortalItem.CreateAsync(await ArcGISPortal.CreateAsync(), "ba99a4a4f5ce48debbeca6713e051f1e");
    Uri imageTileUrl = new Uri("https://ibasemaps-api.arcgis.com/arcgis/rest/services/World_Imagery/MapServer");
    // Feature Service Snippets
    
    GeodatabaseSyncTask geodatabaseSyncTask = await GeodatabaseSyncTask.CreateAsync(featureServiceUrl);
    
    
    
    GenerateGeodatabaseParameters gdbParams = await geodatabaseSyncTask.CreateDefaultGenerateGeodatabaseParametersAsync(areaOfInterest);
    
    GenerateGeodatabaseJob generateJob = geodatabaseSyncTask.GenerateGeodatabase(gdbParams, "path\\to\\file.geodatabase");
    
    
    
    Geodatabase generateResult = await generateJob.GetResultAsync();
    
    
    
    Geodatabase offlineGeodatabase = await Geodatabase.OpenAsync("path\\to\\file.geodatabase");
    
    
    
    Uri serviceUrl = offlineGeodatabase.Source;
    
    GeodatabaseSyncTask gdbSyncTask = await GeodatabaseSyncTask.CreateAsync(serviceUrl);
    
    
    
    SyncGeodatabaseParameters offlineSyncParams = await gdbSyncTask.CreateDefaultSyncGeodatabaseParametersAsync(offlineGeodatabase);
    
    SyncGeodatabaseJob syncJob = gdbSyncTask.SyncGeodatabase(offlineSyncParams, offlineGeodatabase);
    
    
    
    IReadOnlyList<SyncLayerResult> syncResult = await syncJob.GetResultAsync();
    
    if (syncJob.Status != Esri.ArcGISRuntime.Tasks.JobStatus.Succeeded)
    {
        // Handle errors
    }
    
    
    
    // Vector tile snippets
    
    ExportVectorTilesTask exportVectorTilesTask = await ExportVectorTilesTask.CreateAsync(vectorServiceUri);
    
    
    
    ExportVectorTilesParameters exportVectorTilesParams = await exportVectorTilesTask.CreateDefaultExportVectorTilesParametersAsync(areaOfInterest, 0);
    ExportVectorTilesJob exportVectorTilesJob = exportVectorTilesTask.ExportVectorTiles(exportVectorTilesParams, "path\\to\\file.vtpk", "\\path\\to\\cache\\dir");
    
    
    
    ExportVectorTilesResult vectorExportResult = await exportVectorTilesJob.GetResultAsync();
    ArcGISVectorTiledLayer vectorTileLayer = new ArcGISVectorTiledLayer(vectorExportResult.VectorTileCache, vectorExportResult.ItemResourceCache);
    
    
    
    VectorTileCache vectorTileCache = await VectorTileCache.CreateAsync("\\path\\to\\file.vtpk");
    ItemResourceCache itemResourceCache = new ItemResourceCache("\\path\\to\\cache\\dir");
    ArcGISVectorTiledLayer offlineVectorTileLayer = new ArcGISVectorTiledLayer(vectorTileCache, itemResourceCache);
    
    
    // Image tile snippets
    
    ExportTileCacheTask exportImageTilesTask = await ExportTileCacheTask.CreateAsync(imageTileUrl);
    
    
    
    ExportTileCacheParameters exportImageTileParams = await exportImageTilesTask.CreateDefaultExportTileCacheParametersAsync(
        areaOfInterest: areaOfInterest,
        minScale: 500_000_000,
        maxScale: 10_000_000);
    
    ExportTileCacheJob exportImageTilesJob = exportImageTilesTask.ExportTileCache(exportImageTileParams, "\\path\\to\\file.tpk");
    
    
    
    TileCache exportImageTileCacheResult = await exportImageTilesJob.GetResultAsync();
    
    ArcGISTiledLayer imageTiledLayer = new ArcGISTiledLayer(exportImageTileCacheResult);
    
    
    
    TileCache offlineTileCache = new TileCache("\\path\\to\\file.tpk");
    ArcGISTiledLayer reopenedImagedTileLayer = new ArcGISTiledLayer(offlineTileCache);
  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 .NET APIArcGIS Android APIArcGIS iOS APIArcGIS Java APIArcGIS Qt API (C++)ArcGIS Qt API (QML)
                                                                                               
    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
    // test data for convenience only
    Uri featureServiceUrl = new Uri("https://services2.arcgis.com/ZQgQTuoyBrtmoGdP/arcgis/rest/services/US_Bridges/FeatureServer");
    Envelope areaOfInterest = new Envelope(new MapPoint(-118.542587, 34.391663, SpatialReferences.Wgs84), 1, 1);
    areaOfInterest = (Envelope)GeometryEngine.Project(areaOfInterest, SpatialReferences.WebMercator);
    PortalItem hostedItem = await PortalItem.CreateAsync(await ArcGISPortal.CreateAsync(), "ba99a4a4f5ce48debbeca6713e051f1e");
    Uri imageTileUrl = new Uri("https://ibasemaps-api.arcgis.com/arcgis/rest/services/World_Imagery/MapServer");
    // Feature Service Snippets
    
    GeodatabaseSyncTask geodatabaseSyncTask = await GeodatabaseSyncTask.CreateAsync(featureServiceUrl);
    
    
    
    GenerateGeodatabaseParameters gdbParams = await geodatabaseSyncTask.CreateDefaultGenerateGeodatabaseParametersAsync(areaOfInterest);
    
    GenerateGeodatabaseJob generateJob = geodatabaseSyncTask.GenerateGeodatabase(gdbParams, "path\\to\\file.geodatabase");
    
    
    
    Geodatabase generateResult = await generateJob.GetResultAsync();
    
    
    
    Geodatabase offlineGeodatabase = await Geodatabase.OpenAsync("path\\to\\file.geodatabase");
    
    
    
    Uri serviceUrl = offlineGeodatabase.Source;
    
    GeodatabaseSyncTask gdbSyncTask = await GeodatabaseSyncTask.CreateAsync(serviceUrl);
    
    
    
    SyncGeodatabaseParameters offlineSyncParams = await gdbSyncTask.CreateDefaultSyncGeodatabaseParametersAsync(offlineGeodatabase);
    
    SyncGeodatabaseJob syncJob = gdbSyncTask.SyncGeodatabase(offlineSyncParams, offlineGeodatabase);
    
    
    
    IReadOnlyList<SyncLayerResult> syncResult = await syncJob.GetResultAsync();
    
    if (syncJob.Status != Esri.ArcGISRuntime.Tasks.JobStatus.Succeeded)
    {
        // Handle errors
    }
    
    
    
    // Vector tile snippets
    
    ExportVectorTilesTask exportVectorTilesTask = await ExportVectorTilesTask.CreateAsync(vectorServiceUri);
    
    
    
    ExportVectorTilesParameters exportVectorTilesParams = await exportVectorTilesTask.CreateDefaultExportVectorTilesParametersAsync(areaOfInterest, 0);
    ExportVectorTilesJob exportVectorTilesJob = exportVectorTilesTask.ExportVectorTiles(exportVectorTilesParams, "path\\to\\file.vtpk", "\\path\\to\\cache\\dir");
    
    
    
    ExportVectorTilesResult vectorExportResult = await exportVectorTilesJob.GetResultAsync();
    ArcGISVectorTiledLayer vectorTileLayer = new ArcGISVectorTiledLayer(vectorExportResult.VectorTileCache, vectorExportResult.ItemResourceCache);
    
    
    
    VectorTileCache vectorTileCache = await VectorTileCache.CreateAsync("\\path\\to\\file.vtpk");
    ItemResourceCache itemResourceCache = new ItemResourceCache("\\path\\to\\cache\\dir");
    ArcGISVectorTiledLayer offlineVectorTileLayer = new ArcGISVectorTiledLayer(vectorTileCache, itemResourceCache);
    
    
    // Image tile snippets
    
    ExportTileCacheTask exportImageTilesTask = await ExportTileCacheTask.CreateAsync(imageTileUrl);
    
    
    
    ExportTileCacheParameters exportImageTileParams = await exportImageTilesTask.CreateDefaultExportTileCacheParametersAsync(
        areaOfInterest: areaOfInterest,
        minScale: 500_000_000,
        maxScale: 10_000_000);
    
    ExportTileCacheJob exportImageTilesJob = exportImageTilesTask.ExportTileCache(exportImageTileParams, "\\path\\to\\file.tpk");
    
    
    
    TileCache exportImageTileCacheResult = await exportImageTilesJob.GetResultAsync();
    
    ArcGISTiledLayer imageTiledLayer = new ArcGISTiledLayer(exportImageTileCacheResult);
    
    
    
    TileCache offlineTileCache = new TileCache("\\path\\to\\file.tpk");
    ArcGISTiledLayer reopenedImagedTileLayer = new ArcGISTiledLayer(offlineTileCache);
  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 .NET APIArcGIS Android APIArcGIS iOS APIArcGIS Java APIArcGIS Qt API (C++)ArcGIS Qt API (QML)
                                                                                               
    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
    // test data for convenience only
    Uri featureServiceUrl = new Uri("https://services2.arcgis.com/ZQgQTuoyBrtmoGdP/arcgis/rest/services/US_Bridges/FeatureServer");
    Envelope areaOfInterest = new Envelope(new MapPoint(-118.542587, 34.391663, SpatialReferences.Wgs84), 1, 1);
    areaOfInterest = (Envelope)GeometryEngine.Project(areaOfInterest, SpatialReferences.WebMercator);
    PortalItem hostedItem = await PortalItem.CreateAsync(await ArcGISPortal.CreateAsync(), "ba99a4a4f5ce48debbeca6713e051f1e");
    Uri imageTileUrl = new Uri("https://ibasemaps-api.arcgis.com/arcgis/rest/services/World_Imagery/MapServer");
    // Feature Service Snippets
    
    GeodatabaseSyncTask geodatabaseSyncTask = await GeodatabaseSyncTask.CreateAsync(featureServiceUrl);
    
    
    
    GenerateGeodatabaseParameters gdbParams = await geodatabaseSyncTask.CreateDefaultGenerateGeodatabaseParametersAsync(areaOfInterest);
    
    GenerateGeodatabaseJob generateJob = geodatabaseSyncTask.GenerateGeodatabase(gdbParams, "path\\to\\file.geodatabase");
    
    
    
    Geodatabase generateResult = await generateJob.GetResultAsync();
    
    
    
    Geodatabase offlineGeodatabase = await Geodatabase.OpenAsync("path\\to\\file.geodatabase");
    
    
    
    Uri serviceUrl = offlineGeodatabase.Source;
    
    GeodatabaseSyncTask gdbSyncTask = await GeodatabaseSyncTask.CreateAsync(serviceUrl);
    
    
    
    SyncGeodatabaseParameters offlineSyncParams = await gdbSyncTask.CreateDefaultSyncGeodatabaseParametersAsync(offlineGeodatabase);
    
    SyncGeodatabaseJob syncJob = gdbSyncTask.SyncGeodatabase(offlineSyncParams, offlineGeodatabase);
    
    
    
    IReadOnlyList<SyncLayerResult> syncResult = await syncJob.GetResultAsync();
    
    if (syncJob.Status != Esri.ArcGISRuntime.Tasks.JobStatus.Succeeded)
    {
        // Handle errors
    }
    
    
    
    // Vector tile snippets
    
    ExportVectorTilesTask exportVectorTilesTask = await ExportVectorTilesTask.CreateAsync(vectorServiceUri);
    
    
    
    ExportVectorTilesParameters exportVectorTilesParams = await exportVectorTilesTask.CreateDefaultExportVectorTilesParametersAsync(areaOfInterest, 0);
    ExportVectorTilesJob exportVectorTilesJob = exportVectorTilesTask.ExportVectorTiles(exportVectorTilesParams, "path\\to\\file.vtpk", "\\path\\to\\cache\\dir");
    
    
    
    ExportVectorTilesResult vectorExportResult = await exportVectorTilesJob.GetResultAsync();
    ArcGISVectorTiledLayer vectorTileLayer = new ArcGISVectorTiledLayer(vectorExportResult.VectorTileCache, vectorExportResult.ItemResourceCache);
    
    
    
    VectorTileCache vectorTileCache = await VectorTileCache.CreateAsync("\\path\\to\\file.vtpk");
    ItemResourceCache itemResourceCache = new ItemResourceCache("\\path\\to\\cache\\dir");
    ArcGISVectorTiledLayer offlineVectorTileLayer = new ArcGISVectorTiledLayer(vectorTileCache, itemResourceCache);
    
    
    // Image tile snippets
    
    ExportTileCacheTask exportImageTilesTask = await ExportTileCacheTask.CreateAsync(imageTileUrl);
    
    
    
    ExportTileCacheParameters exportImageTileParams = await exportImageTilesTask.CreateDefaultExportTileCacheParametersAsync(
        areaOfInterest: areaOfInterest,
        minScale: 500_000_000,
        maxScale: 10_000_000);
    
    ExportTileCacheJob exportImageTilesJob = exportImageTilesTask.ExportTileCache(exportImageTileParams, "\\path\\to\\file.tpk");
    
    
    
    TileCache exportImageTileCacheResult = await exportImageTilesJob.GetResultAsync();
    
    ArcGISTiledLayer imageTiledLayer = new ArcGISTiledLayer(exportImageTileCacheResult);
    
    
    
    TileCache offlineTileCache = new TileCache("\\path\\to\\file.tpk");
    ArcGISTiledLayer reopenedImagedTileLayer = new ArcGISTiledLayer(offlineTileCache);

Offline data is downloaded from a vector tile service or the basemap layer 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:

  1. Create an Export Vector Tiles Task referencing the vector tile service or basemap layer service.
    ArcGIS .NET APIArcGIS Android APIArcGIS iOS APIArcGIS Java APIArcGIS Qt API (C++)ArcGIS Qt API (QML)
                                                                                               
    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
    // test data for convenience only
    Uri featureServiceUrl = new Uri("https://services2.arcgis.com/ZQgQTuoyBrtmoGdP/arcgis/rest/services/US_Bridges/FeatureServer");
    Envelope areaOfInterest = new Envelope(new MapPoint(-118.542587, 34.391663, SpatialReferences.Wgs84), 1, 1);
    areaOfInterest = (Envelope)GeometryEngine.Project(areaOfInterest, SpatialReferences.WebMercator);
    PortalItem hostedItem = await PortalItem.CreateAsync(await ArcGISPortal.CreateAsync(), "ba99a4a4f5ce48debbeca6713e051f1e");
    Uri imageTileUrl = new Uri("https://ibasemaps-api.arcgis.com/arcgis/rest/services/World_Imagery/MapServer");
    // Feature Service Snippets
    
    GeodatabaseSyncTask geodatabaseSyncTask = await GeodatabaseSyncTask.CreateAsync(featureServiceUrl);
    
    
    
    GenerateGeodatabaseParameters gdbParams = await geodatabaseSyncTask.CreateDefaultGenerateGeodatabaseParametersAsync(areaOfInterest);
    
    GenerateGeodatabaseJob generateJob = geodatabaseSyncTask.GenerateGeodatabase(gdbParams, "path\\to\\file.geodatabase");
    
    
    
    Geodatabase generateResult = await generateJob.GetResultAsync();
    
    
    
    Geodatabase offlineGeodatabase = await Geodatabase.OpenAsync("path\\to\\file.geodatabase");
    
    
    
    Uri serviceUrl = offlineGeodatabase.Source;
    
    GeodatabaseSyncTask gdbSyncTask = await GeodatabaseSyncTask.CreateAsync(serviceUrl);
    
    
    
    SyncGeodatabaseParameters offlineSyncParams = await gdbSyncTask.CreateDefaultSyncGeodatabaseParametersAsync(offlineGeodatabase);
    
    SyncGeodatabaseJob syncJob = gdbSyncTask.SyncGeodatabase(offlineSyncParams, offlineGeodatabase);
    
    
    
    IReadOnlyList<SyncLayerResult> syncResult = await syncJob.GetResultAsync();
    
    if (syncJob.Status != Esri.ArcGISRuntime.Tasks.JobStatus.Succeeded)
    {
        // Handle errors
    }
    
    
    
    // Vector tile snippets
    
    ExportVectorTilesTask exportVectorTilesTask = await ExportVectorTilesTask.CreateAsync(vectorServiceUri);
    
    
    
    ExportVectorTilesParameters exportVectorTilesParams = await exportVectorTilesTask.CreateDefaultExportVectorTilesParametersAsync(areaOfInterest, 0);
    ExportVectorTilesJob exportVectorTilesJob = exportVectorTilesTask.ExportVectorTiles(exportVectorTilesParams, "path\\to\\file.vtpk", "\\path\\to\\cache\\dir");
    
    
    
    ExportVectorTilesResult vectorExportResult = await exportVectorTilesJob.GetResultAsync();
    ArcGISVectorTiledLayer vectorTileLayer = new ArcGISVectorTiledLayer(vectorExportResult.VectorTileCache, vectorExportResult.ItemResourceCache);
    
    
    
    VectorTileCache vectorTileCache = await VectorTileCache.CreateAsync("\\path\\to\\file.vtpk");
    ItemResourceCache itemResourceCache = new ItemResourceCache("\\path\\to\\cache\\dir");
    ArcGISVectorTiledLayer offlineVectorTileLayer = new ArcGISVectorTiledLayer(vectorTileCache, itemResourceCache);
    
    
    // Image tile snippets
    
    ExportTileCacheTask exportImageTilesTask = await ExportTileCacheTask.CreateAsync(imageTileUrl);
    
    
    
    ExportTileCacheParameters exportImageTileParams = await exportImageTilesTask.CreateDefaultExportTileCacheParametersAsync(
        areaOfInterest: areaOfInterest,
        minScale: 500_000_000,
        maxScale: 10_000_000);
    
    ExportTileCacheJob exportImageTilesJob = exportImageTilesTask.ExportTileCache(exportImageTileParams, "\\path\\to\\file.tpk");
    
    
    
    TileCache exportImageTileCacheResult = await exportImageTilesJob.GetResultAsync();
    
    ArcGISTiledLayer imageTiledLayer = new ArcGISTiledLayer(exportImageTileCacheResult);
    
    
    
    TileCache offlineTileCache = new TileCache("\\path\\to\\file.tpk");
    ArcGISTiledLayer reopenedImagedTileLayer = new ArcGISTiledLayer(offlineTileCache);
  2. 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 layer 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 .NET APIArcGIS Android APIArcGIS iOS APIArcGIS Java APIArcGIS Qt API (C++)ArcGIS Qt API (QML)
                                                                                               
    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
    // test data for convenience only
    Uri featureServiceUrl = new Uri("https://services2.arcgis.com/ZQgQTuoyBrtmoGdP/arcgis/rest/services/US_Bridges/FeatureServer");
    Envelope areaOfInterest = new Envelope(new MapPoint(-118.542587, 34.391663, SpatialReferences.Wgs84), 1, 1);
    areaOfInterest = (Envelope)GeometryEngine.Project(areaOfInterest, SpatialReferences.WebMercator);
    PortalItem hostedItem = await PortalItem.CreateAsync(await ArcGISPortal.CreateAsync(), "ba99a4a4f5ce48debbeca6713e051f1e");
    Uri imageTileUrl = new Uri("https://ibasemaps-api.arcgis.com/arcgis/rest/services/World_Imagery/MapServer");
    // Feature Service Snippets
    
    GeodatabaseSyncTask geodatabaseSyncTask = await GeodatabaseSyncTask.CreateAsync(featureServiceUrl);
    
    
    
    GenerateGeodatabaseParameters gdbParams = await geodatabaseSyncTask.CreateDefaultGenerateGeodatabaseParametersAsync(areaOfInterest);
    
    GenerateGeodatabaseJob generateJob = geodatabaseSyncTask.GenerateGeodatabase(gdbParams, "path\\to\\file.geodatabase");
    
    
    
    Geodatabase generateResult = await generateJob.GetResultAsync();
    
    
    
    Geodatabase offlineGeodatabase = await Geodatabase.OpenAsync("path\\to\\file.geodatabase");
    
    
    
    Uri serviceUrl = offlineGeodatabase.Source;
    
    GeodatabaseSyncTask gdbSyncTask = await GeodatabaseSyncTask.CreateAsync(serviceUrl);
    
    
    
    SyncGeodatabaseParameters offlineSyncParams = await gdbSyncTask.CreateDefaultSyncGeodatabaseParametersAsync(offlineGeodatabase);
    
    SyncGeodatabaseJob syncJob = gdbSyncTask.SyncGeodatabase(offlineSyncParams, offlineGeodatabase);
    
    
    
    IReadOnlyList<SyncLayerResult> syncResult = await syncJob.GetResultAsync();
    
    if (syncJob.Status != Esri.ArcGISRuntime.Tasks.JobStatus.Succeeded)
    {
        // Handle errors
    }
    
    
    
    // Vector tile snippets
    
    ExportVectorTilesTask exportVectorTilesTask = await ExportVectorTilesTask.CreateAsync(vectorServiceUri);
    
    
    
    ExportVectorTilesParameters exportVectorTilesParams = await exportVectorTilesTask.CreateDefaultExportVectorTilesParametersAsync(areaOfInterest, 0);
    ExportVectorTilesJob exportVectorTilesJob = exportVectorTilesTask.ExportVectorTiles(exportVectorTilesParams, "path\\to\\file.vtpk", "\\path\\to\\cache\\dir");
    
    
    
    ExportVectorTilesResult vectorExportResult = await exportVectorTilesJob.GetResultAsync();
    ArcGISVectorTiledLayer vectorTileLayer = new ArcGISVectorTiledLayer(vectorExportResult.VectorTileCache, vectorExportResult.ItemResourceCache);
    
    
    
    VectorTileCache vectorTileCache = await VectorTileCache.CreateAsync("\\path\\to\\file.vtpk");
    ItemResourceCache itemResourceCache = new ItemResourceCache("\\path\\to\\cache\\dir");
    ArcGISVectorTiledLayer offlineVectorTileLayer = new ArcGISVectorTiledLayer(vectorTileCache, itemResourceCache);
    
    
    // Image tile snippets
    
    ExportTileCacheTask exportImageTilesTask = await ExportTileCacheTask.CreateAsync(imageTileUrl);
    
    
    
    ExportTileCacheParameters exportImageTileParams = await exportImageTilesTask.CreateDefaultExportTileCacheParametersAsync(
        areaOfInterest: areaOfInterest,
        minScale: 500_000_000,
        maxScale: 10_000_000);
    
    ExportTileCacheJob exportImageTilesJob = exportImageTilesTask.ExportTileCache(exportImageTileParams, "\\path\\to\\file.tpk");
    
    
    
    TileCache exportImageTileCacheResult = await exportImageTilesJob.GetResultAsync();
    
    ArcGISTiledLayer imageTiledLayer = new ArcGISTiledLayer(exportImageTileCacheResult);
    
    
    
    TileCache offlineTileCache = new TileCache("\\path\\to\\file.tpk");
    ArcGISTiledLayer reopenedImagedTileLayer = new ArcGISTiledLayer(offlineTileCache);
  3. 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 .NET APIArcGIS Android APIArcGIS iOS APIArcGIS Java APIArcGIS Qt API (C++)ArcGIS Qt API (QML)
                                                                                               
    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
    // test data for convenience only
    Uri featureServiceUrl = new Uri("https://services2.arcgis.com/ZQgQTuoyBrtmoGdP/arcgis/rest/services/US_Bridges/FeatureServer");
    Envelope areaOfInterest = new Envelope(new MapPoint(-118.542587, 34.391663, SpatialReferences.Wgs84), 1, 1);
    areaOfInterest = (Envelope)GeometryEngine.Project(areaOfInterest, SpatialReferences.WebMercator);
    PortalItem hostedItem = await PortalItem.CreateAsync(await ArcGISPortal.CreateAsync(), "ba99a4a4f5ce48debbeca6713e051f1e");
    Uri imageTileUrl = new Uri("https://ibasemaps-api.arcgis.com/arcgis/rest/services/World_Imagery/MapServer");
    // Feature Service Snippets
    
    GeodatabaseSyncTask geodatabaseSyncTask = await GeodatabaseSyncTask.CreateAsync(featureServiceUrl);
    
    
    
    GenerateGeodatabaseParameters gdbParams = await geodatabaseSyncTask.CreateDefaultGenerateGeodatabaseParametersAsync(areaOfInterest);
    
    GenerateGeodatabaseJob generateJob = geodatabaseSyncTask.GenerateGeodatabase(gdbParams, "path\\to\\file.geodatabase");
    
    
    
    Geodatabase generateResult = await generateJob.GetResultAsync();
    
    
    
    Geodatabase offlineGeodatabase = await Geodatabase.OpenAsync("path\\to\\file.geodatabase");
    
    
    
    Uri serviceUrl = offlineGeodatabase.Source;
    
    GeodatabaseSyncTask gdbSyncTask = await GeodatabaseSyncTask.CreateAsync(serviceUrl);
    
    
    
    SyncGeodatabaseParameters offlineSyncParams = await gdbSyncTask.CreateDefaultSyncGeodatabaseParametersAsync(offlineGeodatabase);
    
    SyncGeodatabaseJob syncJob = gdbSyncTask.SyncGeodatabase(offlineSyncParams, offlineGeodatabase);
    
    
    
    IReadOnlyList<SyncLayerResult> syncResult = await syncJob.GetResultAsync();
    
    if (syncJob.Status != Esri.ArcGISRuntime.Tasks.JobStatus.Succeeded)
    {
        // Handle errors
    }
    
    
    
    // Vector tile snippets
    
    ExportVectorTilesTask exportVectorTilesTask = await ExportVectorTilesTask.CreateAsync(vectorServiceUri);
    
    
    
    ExportVectorTilesParameters exportVectorTilesParams = await exportVectorTilesTask.CreateDefaultExportVectorTilesParametersAsync(areaOfInterest, 0);
    ExportVectorTilesJob exportVectorTilesJob = exportVectorTilesTask.ExportVectorTiles(exportVectorTilesParams, "path\\to\\file.vtpk", "\\path\\to\\cache\\dir");
    
    
    
    ExportVectorTilesResult vectorExportResult = await exportVectorTilesJob.GetResultAsync();
    ArcGISVectorTiledLayer vectorTileLayer = new ArcGISVectorTiledLayer(vectorExportResult.VectorTileCache, vectorExportResult.ItemResourceCache);
    
    
    
    VectorTileCache vectorTileCache = await VectorTileCache.CreateAsync("\\path\\to\\file.vtpk");
    ItemResourceCache itemResourceCache = new ItemResourceCache("\\path\\to\\cache\\dir");
    ArcGISVectorTiledLayer offlineVectorTileLayer = new ArcGISVectorTiledLayer(vectorTileCache, itemResourceCache);
    
    
    // Image tile snippets
    
    ExportTileCacheTask exportImageTilesTask = await ExportTileCacheTask.CreateAsync(imageTileUrl);
    
    
    
    ExportTileCacheParameters exportImageTileParams = await exportImageTilesTask.CreateDefaultExportTileCacheParametersAsync(
        areaOfInterest: areaOfInterest,
        minScale: 500_000_000,
        maxScale: 10_000_000);
    
    ExportTileCacheJob exportImageTilesJob = exportImageTilesTask.ExportTileCache(exportImageTileParams, "\\path\\to\\file.tpk");
    
    
    
    TileCache exportImageTileCacheResult = await exportImageTilesJob.GetResultAsync();
    
    ArcGISTiledLayer imageTiledLayer = new ArcGISTiledLayer(exportImageTileCacheResult);
    
    
    
    TileCache offlineTileCache = new TileCache("\\path\\to\\file.tpk");
    ArcGISTiledLayer reopenedImagedTileLayer = new ArcGISTiledLayer(offlineTileCache);

Offline data is downloaded from an image tile service or the basemap layer service as an image tile package (TPK).

The following default basemap styles are downloaded as an image tile package:

  • ArcGIS:Imagery
  • ArcGIS:Imagery:Standard
  • ArcGIS:Hillshade:*

Other default basemap styles and all custom basemap styles are downloaded as a vector tile package and an item resource cache.

The steps to download offline data as an image tile package (TPK) are:

  1. Create an Export Tile Cache Task referencing the image tile service or basemap layer service.
    ArcGIS .NET APIArcGIS Android APIArcGIS iOS APIArcGIS Java APIArcGIS Qt API (C++)ArcGIS Qt API (QML)
                                                                                               
    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
    // test data for convenience only
    Uri featureServiceUrl = new Uri("https://services2.arcgis.com/ZQgQTuoyBrtmoGdP/arcgis/rest/services/US_Bridges/FeatureServer");
    Envelope areaOfInterest = new Envelope(new MapPoint(-118.542587, 34.391663, SpatialReferences.Wgs84), 1, 1);
    areaOfInterest = (Envelope)GeometryEngine.Project(areaOfInterest, SpatialReferences.WebMercator);
    PortalItem hostedItem = await PortalItem.CreateAsync(await ArcGISPortal.CreateAsync(), "ba99a4a4f5ce48debbeca6713e051f1e");
    Uri imageTileUrl = new Uri("https://ibasemaps-api.arcgis.com/arcgis/rest/services/World_Imagery/MapServer");
    // Feature Service Snippets
    
    GeodatabaseSyncTask geodatabaseSyncTask = await GeodatabaseSyncTask.CreateAsync(featureServiceUrl);
    
    
    
    GenerateGeodatabaseParameters gdbParams = await geodatabaseSyncTask.CreateDefaultGenerateGeodatabaseParametersAsync(areaOfInterest);
    
    GenerateGeodatabaseJob generateJob = geodatabaseSyncTask.GenerateGeodatabase(gdbParams, "path\\to\\file.geodatabase");
    
    
    
    Geodatabase generateResult = await generateJob.GetResultAsync();
    
    
    
    Geodatabase offlineGeodatabase = await Geodatabase.OpenAsync("path\\to\\file.geodatabase");
    
    
    
    Uri serviceUrl = offlineGeodatabase.Source;
    
    GeodatabaseSyncTask gdbSyncTask = await GeodatabaseSyncTask.CreateAsync(serviceUrl);
    
    
    
    SyncGeodatabaseParameters offlineSyncParams = await gdbSyncTask.CreateDefaultSyncGeodatabaseParametersAsync(offlineGeodatabase);
    
    SyncGeodatabaseJob syncJob = gdbSyncTask.SyncGeodatabase(offlineSyncParams, offlineGeodatabase);
    
    
    
    IReadOnlyList<SyncLayerResult> syncResult = await syncJob.GetResultAsync();
    
    if (syncJob.Status != Esri.ArcGISRuntime.Tasks.JobStatus.Succeeded)
    {
        // Handle errors
    }
    
    
    
    // Vector tile snippets
    
    ExportVectorTilesTask exportVectorTilesTask = await ExportVectorTilesTask.CreateAsync(vectorServiceUri);
    
    
    
    ExportVectorTilesParameters exportVectorTilesParams = await exportVectorTilesTask.CreateDefaultExportVectorTilesParametersAsync(areaOfInterest, 0);
    ExportVectorTilesJob exportVectorTilesJob = exportVectorTilesTask.ExportVectorTiles(exportVectorTilesParams, "path\\to\\file.vtpk", "\\path\\to\\cache\\dir");
    
    
    
    ExportVectorTilesResult vectorExportResult = await exportVectorTilesJob.GetResultAsync();
    ArcGISVectorTiledLayer vectorTileLayer = new ArcGISVectorTiledLayer(vectorExportResult.VectorTileCache, vectorExportResult.ItemResourceCache);
    
    
    
    VectorTileCache vectorTileCache = await VectorTileCache.CreateAsync("\\path\\to\\file.vtpk");
    ItemResourceCache itemResourceCache = new ItemResourceCache("\\path\\to\\cache\\dir");
    ArcGISVectorTiledLayer offlineVectorTileLayer = new ArcGISVectorTiledLayer(vectorTileCache, itemResourceCache);
    
    
    // Image tile snippets
    
    ExportTileCacheTask exportImageTilesTask = await ExportTileCacheTask.CreateAsync(imageTileUrl);
    
    
    
    ExportTileCacheParameters exportImageTileParams = await exportImageTilesTask.CreateDefaultExportTileCacheParametersAsync(
        areaOfInterest: areaOfInterest,
        minScale: 500_000_000,
        maxScale: 10_000_000);
    
    ExportTileCacheJob exportImageTilesJob = exportImageTilesTask.ExportTileCache(exportImageTileParams, "\\path\\to\\file.tpk");
    
    
    
    TileCache exportImageTileCacheResult = await exportImageTilesJob.GetResultAsync();
    
    ArcGISTiledLayer imageTiledLayer = new ArcGISTiledLayer(exportImageTileCacheResult);
    
    
    
    TileCache offlineTileCache = new TileCache("\\path\\to\\file.tpk");
    ArcGISTiledLayer reopenedImagedTileLayer = new ArcGISTiledLayer(offlineTileCache);
  2. 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 .NET APIArcGIS Android APIArcGIS iOS APIArcGIS Java APIArcGIS Qt API (C++)ArcGIS Qt API (QML)
                                                                                               
    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
    // test data for convenience only
    Uri featureServiceUrl = new Uri("https://services2.arcgis.com/ZQgQTuoyBrtmoGdP/arcgis/rest/services/US_Bridges/FeatureServer");
    Envelope areaOfInterest = new Envelope(new MapPoint(-118.542587, 34.391663, SpatialReferences.Wgs84), 1, 1);
    areaOfInterest = (Envelope)GeometryEngine.Project(areaOfInterest, SpatialReferences.WebMercator);
    PortalItem hostedItem = await PortalItem.CreateAsync(await ArcGISPortal.CreateAsync(), "ba99a4a4f5ce48debbeca6713e051f1e");
    Uri imageTileUrl = new Uri("https://ibasemaps-api.arcgis.com/arcgis/rest/services/World_Imagery/MapServer");
    // Feature Service Snippets
    
    GeodatabaseSyncTask geodatabaseSyncTask = await GeodatabaseSyncTask.CreateAsync(featureServiceUrl);
    
    
    
    GenerateGeodatabaseParameters gdbParams = await geodatabaseSyncTask.CreateDefaultGenerateGeodatabaseParametersAsync(areaOfInterest);
    
    GenerateGeodatabaseJob generateJob = geodatabaseSyncTask.GenerateGeodatabase(gdbParams, "path\\to\\file.geodatabase");
    
    
    
    Geodatabase generateResult = await generateJob.GetResultAsync();
    
    
    
    Geodatabase offlineGeodatabase = await Geodatabase.OpenAsync("path\\to\\file.geodatabase");
    
    
    
    Uri serviceUrl = offlineGeodatabase.Source;
    
    GeodatabaseSyncTask gdbSyncTask = await GeodatabaseSyncTask.CreateAsync(serviceUrl);
    
    
    
    SyncGeodatabaseParameters offlineSyncParams = await gdbSyncTask.CreateDefaultSyncGeodatabaseParametersAsync(offlineGeodatabase);
    
    SyncGeodatabaseJob syncJob = gdbSyncTask.SyncGeodatabase(offlineSyncParams, offlineGeodatabase);
    
    
    
    IReadOnlyList<SyncLayerResult> syncResult = await syncJob.GetResultAsync();
    
    if (syncJob.Status != Esri.ArcGISRuntime.Tasks.JobStatus.Succeeded)
    {
        // Handle errors
    }
    
    
    
    // Vector tile snippets
    
    ExportVectorTilesTask exportVectorTilesTask = await ExportVectorTilesTask.CreateAsync(vectorServiceUri);
    
    
    
    ExportVectorTilesParameters exportVectorTilesParams = await exportVectorTilesTask.CreateDefaultExportVectorTilesParametersAsync(areaOfInterest, 0);
    ExportVectorTilesJob exportVectorTilesJob = exportVectorTilesTask.ExportVectorTiles(exportVectorTilesParams, "path\\to\\file.vtpk", "\\path\\to\\cache\\dir");
    
    
    
    ExportVectorTilesResult vectorExportResult = await exportVectorTilesJob.GetResultAsync();
    ArcGISVectorTiledLayer vectorTileLayer = new ArcGISVectorTiledLayer(vectorExportResult.VectorTileCache, vectorExportResult.ItemResourceCache);
    
    
    
    VectorTileCache vectorTileCache = await VectorTileCache.CreateAsync("\\path\\to\\file.vtpk");
    ItemResourceCache itemResourceCache = new ItemResourceCache("\\path\\to\\cache\\dir");
    ArcGISVectorTiledLayer offlineVectorTileLayer = new ArcGISVectorTiledLayer(vectorTileCache, itemResourceCache);
    
    
    // Image tile snippets
    
    ExportTileCacheTask exportImageTilesTask = await ExportTileCacheTask.CreateAsync(imageTileUrl);
    
    
    
    ExportTileCacheParameters exportImageTileParams = await exportImageTilesTask.CreateDefaultExportTileCacheParametersAsync(
        areaOfInterest: areaOfInterest,
        minScale: 500_000_000,
        maxScale: 10_000_000);
    
    ExportTileCacheJob exportImageTilesJob = exportImageTilesTask.ExportTileCache(exportImageTileParams, "\\path\\to\\file.tpk");
    
    
    
    TileCache exportImageTileCacheResult = await exportImageTilesJob.GetResultAsync();
    
    ArcGISTiledLayer imageTiledLayer = new ArcGISTiledLayer(exportImageTileCacheResult);
    
    
    
    TileCache offlineTileCache = new TileCache("\\path\\to\\file.tpk");
    ArcGISTiledLayer reopenedImagedTileLayer = new ArcGISTiledLayer(offlineTileCache);
  3. 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 .NET APIArcGIS Android APIArcGIS iOS APIArcGIS Java APIArcGIS Qt API (C++)ArcGIS Qt API (QML)
                                                                                               
    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
    // test data for convenience only
    Uri featureServiceUrl = new Uri("https://services2.arcgis.com/ZQgQTuoyBrtmoGdP/arcgis/rest/services/US_Bridges/FeatureServer");
    Envelope areaOfInterest = new Envelope(new MapPoint(-118.542587, 34.391663, SpatialReferences.Wgs84), 1, 1);
    areaOfInterest = (Envelope)GeometryEngine.Project(areaOfInterest, SpatialReferences.WebMercator);
    PortalItem hostedItem = await PortalItem.CreateAsync(await ArcGISPortal.CreateAsync(), "ba99a4a4f5ce48debbeca6713e051f1e");
    Uri imageTileUrl = new Uri("https://ibasemaps-api.arcgis.com/arcgis/rest/services/World_Imagery/MapServer");
    // Feature Service Snippets
    
    GeodatabaseSyncTask geodatabaseSyncTask = await GeodatabaseSyncTask.CreateAsync(featureServiceUrl);
    
    
    
    GenerateGeodatabaseParameters gdbParams = await geodatabaseSyncTask.CreateDefaultGenerateGeodatabaseParametersAsync(areaOfInterest);
    
    GenerateGeodatabaseJob generateJob = geodatabaseSyncTask.GenerateGeodatabase(gdbParams, "path\\to\\file.geodatabase");
    
    
    
    Geodatabase generateResult = await generateJob.GetResultAsync();
    
    
    
    Geodatabase offlineGeodatabase = await Geodatabase.OpenAsync("path\\to\\file.geodatabase");
    
    
    
    Uri serviceUrl = offlineGeodatabase.Source;
    
    GeodatabaseSyncTask gdbSyncTask = await GeodatabaseSyncTask.CreateAsync(serviceUrl);
    
    
    
    SyncGeodatabaseParameters offlineSyncParams = await gdbSyncTask.CreateDefaultSyncGeodatabaseParametersAsync(offlineGeodatabase);
    
    SyncGeodatabaseJob syncJob = gdbSyncTask.SyncGeodatabase(offlineSyncParams, offlineGeodatabase);
    
    
    
    IReadOnlyList<SyncLayerResult> syncResult = await syncJob.GetResultAsync();
    
    if (syncJob.Status != Esri.ArcGISRuntime.Tasks.JobStatus.Succeeded)
    {
        // Handle errors
    }
    
    
    
    // Vector tile snippets
    
    ExportVectorTilesTask exportVectorTilesTask = await ExportVectorTilesTask.CreateAsync(vectorServiceUri);
    
    
    
    ExportVectorTilesParameters exportVectorTilesParams = await exportVectorTilesTask.CreateDefaultExportVectorTilesParametersAsync(areaOfInterest, 0);
    ExportVectorTilesJob exportVectorTilesJob = exportVectorTilesTask.ExportVectorTiles(exportVectorTilesParams, "path\\to\\file.vtpk", "\\path\\to\\cache\\dir");
    
    
    
    ExportVectorTilesResult vectorExportResult = await exportVectorTilesJob.GetResultAsync();
    ArcGISVectorTiledLayer vectorTileLayer = new ArcGISVectorTiledLayer(vectorExportResult.VectorTileCache, vectorExportResult.ItemResourceCache);
    
    
    
    VectorTileCache vectorTileCache = await VectorTileCache.CreateAsync("\\path\\to\\file.vtpk");
    ItemResourceCache itemResourceCache = new ItemResourceCache("\\path\\to\\cache\\dir");
    ArcGISVectorTiledLayer offlineVectorTileLayer = new ArcGISVectorTiledLayer(vectorTileCache, itemResourceCache);
    
    
    // Image tile snippets
    
    ExportTileCacheTask exportImageTilesTask = await ExportTileCacheTask.CreateAsync(imageTileUrl);
    
    
    
    ExportTileCacheParameters exportImageTileParams = await exportImageTilesTask.CreateDefaultExportTileCacheParametersAsync(
        areaOfInterest: areaOfInterest,
        minScale: 500_000_000,
        maxScale: 10_000_000);
    
    ExportTileCacheJob exportImageTilesJob = exportImageTilesTask.ExportTileCache(exportImageTileParams, "\\path\\to\\file.tpk");
    
    
    
    TileCache exportImageTileCacheResult = await exportImageTilesJob.GetResultAsync();
    
    ArcGISTiledLayer imageTiledLayer = new ArcGISTiledLayer(exportImageTileCacheResult);
    
    
    
    TileCache offlineTileCache = new TileCache("\\path\\to\\file.tpk");
    ArcGISTiledLayer reopenedImagedTileLayer = new ArcGISTiledLayer(offlineTileCache);

Access

When you first download offline data the ArcGIS Runtime API 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

Feature serviceVector tile serviceImage tile service

Access previously downloaded offline data from a feature service by creating a Geodatabase from the downloaded geodatabase file:

ArcGIS .NET APIArcGIS Android APIArcGIS iOS APIArcGIS Java APIArcGIS Qt API (C++)ArcGIS Qt API (QML)
                                                                                           
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
// test data for convenience only
Uri featureServiceUrl = new Uri("https://services2.arcgis.com/ZQgQTuoyBrtmoGdP/arcgis/rest/services/US_Bridges/FeatureServer");
Envelope areaOfInterest = new Envelope(new MapPoint(-118.542587, 34.391663, SpatialReferences.Wgs84), 1, 1);
areaOfInterest = (Envelope)GeometryEngine.Project(areaOfInterest, SpatialReferences.WebMercator);
PortalItem hostedItem = await PortalItem.CreateAsync(await ArcGISPortal.CreateAsync(), "ba99a4a4f5ce48debbeca6713e051f1e");
Uri imageTileUrl = new Uri("https://ibasemaps-api.arcgis.com/arcgis/rest/services/World_Imagery/MapServer");
// Feature Service Snippets

GeodatabaseSyncTask geodatabaseSyncTask = await GeodatabaseSyncTask.CreateAsync(featureServiceUrl);



GenerateGeodatabaseParameters gdbParams = await geodatabaseSyncTask.CreateDefaultGenerateGeodatabaseParametersAsync(areaOfInterest);

GenerateGeodatabaseJob generateJob = geodatabaseSyncTask.GenerateGeodatabase(gdbParams, "path\\to\\file.geodatabase");



Geodatabase generateResult = await generateJob.GetResultAsync();



Geodatabase offlineGeodatabase = await Geodatabase.OpenAsync("path\\to\\file.geodatabase");



Uri serviceUrl = offlineGeodatabase.Source;

GeodatabaseSyncTask gdbSyncTask = await GeodatabaseSyncTask.CreateAsync(serviceUrl);



SyncGeodatabaseParameters offlineSyncParams = await gdbSyncTask.CreateDefaultSyncGeodatabaseParametersAsync(offlineGeodatabase);

SyncGeodatabaseJob syncJob = gdbSyncTask.SyncGeodatabase(offlineSyncParams, offlineGeodatabase);



IReadOnlyList<SyncLayerResult> syncResult = await syncJob.GetResultAsync();

if (syncJob.Status != Esri.ArcGISRuntime.Tasks.JobStatus.Succeeded)
{
    // Handle errors
}



// Vector tile snippets

ExportVectorTilesTask exportVectorTilesTask = await ExportVectorTilesTask.CreateAsync(vectorServiceUri);



ExportVectorTilesParameters exportVectorTilesParams = await exportVectorTilesTask.CreateDefaultExportVectorTilesParametersAsync(areaOfInterest, 0);
ExportVectorTilesJob exportVectorTilesJob = exportVectorTilesTask.ExportVectorTiles(exportVectorTilesParams, "path\\to\\file.vtpk", "\\path\\to\\cache\\dir");



ExportVectorTilesResult vectorExportResult = await exportVectorTilesJob.GetResultAsync();
ArcGISVectorTiledLayer vectorTileLayer = new ArcGISVectorTiledLayer(vectorExportResult.VectorTileCache, vectorExportResult.ItemResourceCache);



VectorTileCache vectorTileCache = await VectorTileCache.CreateAsync("\\path\\to\\file.vtpk");
ItemResourceCache itemResourceCache = new ItemResourceCache("\\path\\to\\cache\\dir");
ArcGISVectorTiledLayer offlineVectorTileLayer = new ArcGISVectorTiledLayer(vectorTileCache, itemResourceCache);


// Image tile snippets

ExportTileCacheTask exportImageTilesTask = await ExportTileCacheTask.CreateAsync(imageTileUrl);



ExportTileCacheParameters exportImageTileParams = await exportImageTilesTask.CreateDefaultExportTileCacheParametersAsync(
    areaOfInterest: areaOfInterest,
    minScale: 500_000_000,
    maxScale: 10_000_000);

ExportTileCacheJob exportImageTilesJob = exportImageTilesTask.ExportTileCache(exportImageTileParams, "\\path\\to\\file.tpk");



TileCache exportImageTileCacheResult = await exportImageTilesJob.GetResultAsync();

ArcGISTiledLayer imageTiledLayer = new ArcGISTiledLayer(exportImageTileCacheResult);



TileCache offlineTileCache = new TileCache("\\path\\to\\file.tpk");
ArcGISTiledLayer reopenedImagedTileLayer = new ArcGISTiledLayer(offlineTileCache);

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:

  1. Create a Vector Tile Cache from the downloaded VTPK file.

  2. Optionally create an Item Resource Cache from the downloaded item resource cache folder.

    ArcGIS .NET APIArcGIS Android APIArcGIS iOS APIArcGIS Java APIArcGIS Qt API (C++)ArcGIS Qt API (QML)
                                                                                               
    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
    // test data for convenience only
    Uri featureServiceUrl = new Uri("https://services2.arcgis.com/ZQgQTuoyBrtmoGdP/arcgis/rest/services/US_Bridges/FeatureServer");
    Envelope areaOfInterest = new Envelope(new MapPoint(-118.542587, 34.391663, SpatialReferences.Wgs84), 1, 1);
    areaOfInterest = (Envelope)GeometryEngine.Project(areaOfInterest, SpatialReferences.WebMercator);
    PortalItem hostedItem = await PortalItem.CreateAsync(await ArcGISPortal.CreateAsync(), "ba99a4a4f5ce48debbeca6713e051f1e");
    Uri imageTileUrl = new Uri("https://ibasemaps-api.arcgis.com/arcgis/rest/services/World_Imagery/MapServer");
    // Feature Service Snippets
    
    GeodatabaseSyncTask geodatabaseSyncTask = await GeodatabaseSyncTask.CreateAsync(featureServiceUrl);
    
    
    
    GenerateGeodatabaseParameters gdbParams = await geodatabaseSyncTask.CreateDefaultGenerateGeodatabaseParametersAsync(areaOfInterest);
    
    GenerateGeodatabaseJob generateJob = geodatabaseSyncTask.GenerateGeodatabase(gdbParams, "path\\to\\file.geodatabase");
    
    
    
    Geodatabase generateResult = await generateJob.GetResultAsync();
    
    
    
    Geodatabase offlineGeodatabase = await Geodatabase.OpenAsync("path\\to\\file.geodatabase");
    
    
    
    Uri serviceUrl = offlineGeodatabase.Source;
    
    GeodatabaseSyncTask gdbSyncTask = await GeodatabaseSyncTask.CreateAsync(serviceUrl);
    
    
    
    SyncGeodatabaseParameters offlineSyncParams = await gdbSyncTask.CreateDefaultSyncGeodatabaseParametersAsync(offlineGeodatabase);
    
    SyncGeodatabaseJob syncJob = gdbSyncTask.SyncGeodatabase(offlineSyncParams, offlineGeodatabase);
    
    
    
    IReadOnlyList<SyncLayerResult> syncResult = await syncJob.GetResultAsync();
    
    if (syncJob.Status != Esri.ArcGISRuntime.Tasks.JobStatus.Succeeded)
    {
        // Handle errors
    }
    
    
    
    // Vector tile snippets
    
    ExportVectorTilesTask exportVectorTilesTask = await ExportVectorTilesTask.CreateAsync(vectorServiceUri);
    
    
    
    ExportVectorTilesParameters exportVectorTilesParams = await exportVectorTilesTask.CreateDefaultExportVectorTilesParametersAsync(areaOfInterest, 0);
    ExportVectorTilesJob exportVectorTilesJob = exportVectorTilesTask.ExportVectorTiles(exportVectorTilesParams, "path\\to\\file.vtpk", "\\path\\to\\cache\\dir");
    
    
    
    ExportVectorTilesResult vectorExportResult = await exportVectorTilesJob.GetResultAsync();
    ArcGISVectorTiledLayer vectorTileLayer = new ArcGISVectorTiledLayer(vectorExportResult.VectorTileCache, vectorExportResult.ItemResourceCache);
    
    
    
    VectorTileCache vectorTileCache = await VectorTileCache.CreateAsync("\\path\\to\\file.vtpk");
    ItemResourceCache itemResourceCache = new ItemResourceCache("\\path\\to\\cache\\dir");
    ArcGISVectorTiledLayer offlineVectorTileLayer = new ArcGISVectorTiledLayer(vectorTileCache, itemResourceCache);
    
    
    // Image tile snippets
    
    ExportTileCacheTask exportImageTilesTask = await ExportTileCacheTask.CreateAsync(imageTileUrl);
    
    
    
    ExportTileCacheParameters exportImageTileParams = await exportImageTilesTask.CreateDefaultExportTileCacheParametersAsync(
        areaOfInterest: areaOfInterest,
        minScale: 500_000_000,
        maxScale: 10_000_000);
    
    ExportTileCacheJob exportImageTilesJob = exportImageTilesTask.ExportTileCache(exportImageTileParams, "\\path\\to\\file.tpk");
    
    
    
    TileCache exportImageTileCacheResult = await exportImageTilesJob.GetResultAsync();
    
    ArcGISTiledLayer imageTiledLayer = new ArcGISTiledLayer(exportImageTileCacheResult);
    
    
    
    TileCache offlineTileCache = new TileCache("\\path\\to\\file.tpk");
    ArcGISTiledLayer reopenedImagedTileLayer = new ArcGISTiledLayer(offlineTileCache);

Use the Vector Tile Cache and optional Item Resource Cache to create an ArcGIS Vector Tiled Layer which can be added to a map


Access previously downloaded offline data from an image tile package (TPK) by creating a Tile Cache from the downloaded TPK file:

ArcGIS .NET APIArcGIS Android APIArcGIS iOS APIArcGIS Java APIArcGIS Qt API (C++)ArcGIS Qt API (QML)
                                                                                           
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
// test data for convenience only
Uri featureServiceUrl = new Uri("https://services2.arcgis.com/ZQgQTuoyBrtmoGdP/arcgis/rest/services/US_Bridges/FeatureServer");
Envelope areaOfInterest = new Envelope(new MapPoint(-118.542587, 34.391663, SpatialReferences.Wgs84), 1, 1);
areaOfInterest = (Envelope)GeometryEngine.Project(areaOfInterest, SpatialReferences.WebMercator);
PortalItem hostedItem = await PortalItem.CreateAsync(await ArcGISPortal.CreateAsync(), "ba99a4a4f5ce48debbeca6713e051f1e");
Uri imageTileUrl = new Uri("https://ibasemaps-api.arcgis.com/arcgis/rest/services/World_Imagery/MapServer");
// Feature Service Snippets

GeodatabaseSyncTask geodatabaseSyncTask = await GeodatabaseSyncTask.CreateAsync(featureServiceUrl);



GenerateGeodatabaseParameters gdbParams = await geodatabaseSyncTask.CreateDefaultGenerateGeodatabaseParametersAsync(areaOfInterest);

GenerateGeodatabaseJob generateJob = geodatabaseSyncTask.GenerateGeodatabase(gdbParams, "path\\to\\file.geodatabase");



Geodatabase generateResult = await generateJob.GetResultAsync();



Geodatabase offlineGeodatabase = await Geodatabase.OpenAsync("path\\to\\file.geodatabase");



Uri serviceUrl = offlineGeodatabase.Source;

GeodatabaseSyncTask gdbSyncTask = await GeodatabaseSyncTask.CreateAsync(serviceUrl);



SyncGeodatabaseParameters offlineSyncParams = await gdbSyncTask.CreateDefaultSyncGeodatabaseParametersAsync(offlineGeodatabase);

SyncGeodatabaseJob syncJob = gdbSyncTask.SyncGeodatabase(offlineSyncParams, offlineGeodatabase);



IReadOnlyList<SyncLayerResult> syncResult = await syncJob.GetResultAsync();

if (syncJob.Status != Esri.ArcGISRuntime.Tasks.JobStatus.Succeeded)
{
    // Handle errors
}



// Vector tile snippets

ExportVectorTilesTask exportVectorTilesTask = await ExportVectorTilesTask.CreateAsync(vectorServiceUri);



ExportVectorTilesParameters exportVectorTilesParams = await exportVectorTilesTask.CreateDefaultExportVectorTilesParametersAsync(areaOfInterest, 0);
ExportVectorTilesJob exportVectorTilesJob = exportVectorTilesTask.ExportVectorTiles(exportVectorTilesParams, "path\\to\\file.vtpk", "\\path\\to\\cache\\dir");



ExportVectorTilesResult vectorExportResult = await exportVectorTilesJob.GetResultAsync();
ArcGISVectorTiledLayer vectorTileLayer = new ArcGISVectorTiledLayer(vectorExportResult.VectorTileCache, vectorExportResult.ItemResourceCache);



VectorTileCache vectorTileCache = await VectorTileCache.CreateAsync("\\path\\to\\file.vtpk");
ItemResourceCache itemResourceCache = new ItemResourceCache("\\path\\to\\cache\\dir");
ArcGISVectorTiledLayer offlineVectorTileLayer = new ArcGISVectorTiledLayer(vectorTileCache, itemResourceCache);


// Image tile snippets

ExportTileCacheTask exportImageTilesTask = await ExportTileCacheTask.CreateAsync(imageTileUrl);



ExportTileCacheParameters exportImageTileParams = await exportImageTilesTask.CreateDefaultExportTileCacheParametersAsync(
    areaOfInterest: areaOfInterest,
    minScale: 500_000_000,
    maxScale: 10_000_000);

ExportTileCacheJob exportImageTilesJob = exportImageTilesTask.ExportTileCache(exportImageTileParams, "\\path\\to\\file.tpk");



TileCache exportImageTileCacheResult = await exportImageTilesJob.GetResultAsync();

ArcGISTiledLayer imageTiledLayer = new ArcGISTiledLayer(exportImageTileCacheResult);



TileCache offlineTileCache = new TileCache("\\path\\to\\file.tpk");
ArcGISTiledLayer reopenedImagedTileLayer = new ArcGISTiledLayer(offlineTileCache);

Use the Tile Cache to create an ArcGIS Tiled 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 .NET APIArcGIS Android APIArcGIS iOS APIArcGIS Java APIArcGIS Qt API (C++)ArcGIS Qt API (QML)
                                                                                               
    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
    // test data for convenience only
    Uri featureServiceUrl = new Uri("https://services2.arcgis.com/ZQgQTuoyBrtmoGdP/arcgis/rest/services/US_Bridges/FeatureServer");
    Envelope areaOfInterest = new Envelope(new MapPoint(-118.542587, 34.391663, SpatialReferences.Wgs84), 1, 1);
    areaOfInterest = (Envelope)GeometryEngine.Project(areaOfInterest, SpatialReferences.WebMercator);
    PortalItem hostedItem = await PortalItem.CreateAsync(await ArcGISPortal.CreateAsync(), "ba99a4a4f5ce48debbeca6713e051f1e");
    Uri imageTileUrl = new Uri("https://ibasemaps-api.arcgis.com/arcgis/rest/services/World_Imagery/MapServer");
    // Feature Service Snippets
    
    GeodatabaseSyncTask geodatabaseSyncTask = await GeodatabaseSyncTask.CreateAsync(featureServiceUrl);
    
    
    
    GenerateGeodatabaseParameters gdbParams = await geodatabaseSyncTask.CreateDefaultGenerateGeodatabaseParametersAsync(areaOfInterest);
    
    GenerateGeodatabaseJob generateJob = geodatabaseSyncTask.GenerateGeodatabase(gdbParams, "path\\to\\file.geodatabase");
    
    
    
    Geodatabase generateResult = await generateJob.GetResultAsync();
    
    
    
    Geodatabase offlineGeodatabase = await Geodatabase.OpenAsync("path\\to\\file.geodatabase");
    
    
    
    Uri serviceUrl = offlineGeodatabase.Source;
    
    GeodatabaseSyncTask gdbSyncTask = await GeodatabaseSyncTask.CreateAsync(serviceUrl);
    
    
    
    SyncGeodatabaseParameters offlineSyncParams = await gdbSyncTask.CreateDefaultSyncGeodatabaseParametersAsync(offlineGeodatabase);
    
    SyncGeodatabaseJob syncJob = gdbSyncTask.SyncGeodatabase(offlineSyncParams, offlineGeodatabase);
    
    
    
    IReadOnlyList<SyncLayerResult> syncResult = await syncJob.GetResultAsync();
    
    if (syncJob.Status != Esri.ArcGISRuntime.Tasks.JobStatus.Succeeded)
    {
        // Handle errors
    }
    
    
    
    // Vector tile snippets
    
    ExportVectorTilesTask exportVectorTilesTask = await ExportVectorTilesTask.CreateAsync(vectorServiceUri);
    
    
    
    ExportVectorTilesParameters exportVectorTilesParams = await exportVectorTilesTask.CreateDefaultExportVectorTilesParametersAsync(areaOfInterest, 0);
    ExportVectorTilesJob exportVectorTilesJob = exportVectorTilesTask.ExportVectorTiles(exportVectorTilesParams, "path\\to\\file.vtpk", "\\path\\to\\cache\\dir");
    
    
    
    ExportVectorTilesResult vectorExportResult = await exportVectorTilesJob.GetResultAsync();
    ArcGISVectorTiledLayer vectorTileLayer = new ArcGISVectorTiledLayer(vectorExportResult.VectorTileCache, vectorExportResult.ItemResourceCache);
    
    
    
    VectorTileCache vectorTileCache = await VectorTileCache.CreateAsync("\\path\\to\\file.vtpk");
    ItemResourceCache itemResourceCache = new ItemResourceCache("\\path\\to\\cache\\dir");
    ArcGISVectorTiledLayer offlineVectorTileLayer = new ArcGISVectorTiledLayer(vectorTileCache, itemResourceCache);
    
    
    // Image tile snippets
    
    ExportTileCacheTask exportImageTilesTask = await ExportTileCacheTask.CreateAsync(imageTileUrl);
    
    
    
    ExportTileCacheParameters exportImageTileParams = await exportImageTilesTask.CreateDefaultExportTileCacheParametersAsync(
        areaOfInterest: areaOfInterest,
        minScale: 500_000_000,
        maxScale: 10_000_000);
    
    ExportTileCacheJob exportImageTilesJob = exportImageTilesTask.ExportTileCache(exportImageTileParams, "\\path\\to\\file.tpk");
    
    
    
    TileCache exportImageTileCacheResult = await exportImageTilesJob.GetResultAsync();
    
    ArcGISTiledLayer imageTiledLayer = new ArcGISTiledLayer(exportImageTileCacheResult);
    
    
    
    TileCache offlineTileCache = new TileCache("\\path\\to\\file.tpk");
    ArcGISTiledLayer reopenedImagedTileLayer = new ArcGISTiledLayer(offlineTileCache);
  2. Use the Geodatabase Sync Task to create a Geodatabase Sync Job by providing the previously downloaded Geodatabase.

    ArcGIS .NET APIArcGIS Android APIArcGIS iOS APIArcGIS Java APIArcGIS Qt API (C++)ArcGIS Qt API (QML)
                                                                                               
    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
    // test data for convenience only
    Uri featureServiceUrl = new Uri("https://services2.arcgis.com/ZQgQTuoyBrtmoGdP/arcgis/rest/services/US_Bridges/FeatureServer");
    Envelope areaOfInterest = new Envelope(new MapPoint(-118.542587, 34.391663, SpatialReferences.Wgs84), 1, 1);
    areaOfInterest = (Envelope)GeometryEngine.Project(areaOfInterest, SpatialReferences.WebMercator);
    PortalItem hostedItem = await PortalItem.CreateAsync(await ArcGISPortal.CreateAsync(), "ba99a4a4f5ce48debbeca6713e051f1e");
    Uri imageTileUrl = new Uri("https://ibasemaps-api.arcgis.com/arcgis/rest/services/World_Imagery/MapServer");
    // Feature Service Snippets
    
    GeodatabaseSyncTask geodatabaseSyncTask = await GeodatabaseSyncTask.CreateAsync(featureServiceUrl);
    
    
    
    GenerateGeodatabaseParameters gdbParams = await geodatabaseSyncTask.CreateDefaultGenerateGeodatabaseParametersAsync(areaOfInterest);
    
    GenerateGeodatabaseJob generateJob = geodatabaseSyncTask.GenerateGeodatabase(gdbParams, "path\\to\\file.geodatabase");
    
    
    
    Geodatabase generateResult = await generateJob.GetResultAsync();
    
    
    
    Geodatabase offlineGeodatabase = await Geodatabase.OpenAsync("path\\to\\file.geodatabase");
    
    
    
    Uri serviceUrl = offlineGeodatabase.Source;
    
    GeodatabaseSyncTask gdbSyncTask = await GeodatabaseSyncTask.CreateAsync(serviceUrl);
    
    
    
    SyncGeodatabaseParameters offlineSyncParams = await gdbSyncTask.CreateDefaultSyncGeodatabaseParametersAsync(offlineGeodatabase);
    
    SyncGeodatabaseJob syncJob = gdbSyncTask.SyncGeodatabase(offlineSyncParams, offlineGeodatabase);
    
    
    
    IReadOnlyList<SyncLayerResult> syncResult = await syncJob.GetResultAsync();
    
    if (syncJob.Status != Esri.ArcGISRuntime.Tasks.JobStatus.Succeeded)
    {
        // Handle errors
    }
    
    
    
    // Vector tile snippets
    
    ExportVectorTilesTask exportVectorTilesTask = await ExportVectorTilesTask.CreateAsync(vectorServiceUri);
    
    
    
    ExportVectorTilesParameters exportVectorTilesParams = await exportVectorTilesTask.CreateDefaultExportVectorTilesParametersAsync(areaOfInterest, 0);
    ExportVectorTilesJob exportVectorTilesJob = exportVectorTilesTask.ExportVectorTiles(exportVectorTilesParams, "path\\to\\file.vtpk", "\\path\\to\\cache\\dir");
    
    
    
    ExportVectorTilesResult vectorExportResult = await exportVectorTilesJob.GetResultAsync();
    ArcGISVectorTiledLayer vectorTileLayer = new ArcGISVectorTiledLayer(vectorExportResult.VectorTileCache, vectorExportResult.ItemResourceCache);
    
    
    
    VectorTileCache vectorTileCache = await VectorTileCache.CreateAsync("\\path\\to\\file.vtpk");
    ItemResourceCache itemResourceCache = new ItemResourceCache("\\path\\to\\cache\\dir");
    ArcGISVectorTiledLayer offlineVectorTileLayer = new ArcGISVectorTiledLayer(vectorTileCache, itemResourceCache);
    
    
    // Image tile snippets
    
    ExportTileCacheTask exportImageTilesTask = await ExportTileCacheTask.CreateAsync(imageTileUrl);
    
    
    
    ExportTileCacheParameters exportImageTileParams = await exportImageTilesTask.CreateDefaultExportTileCacheParametersAsync(
        areaOfInterest: areaOfInterest,
        minScale: 500_000_000,
        maxScale: 10_000_000);
    
    ExportTileCacheJob exportImageTilesJob = exportImageTilesTask.ExportTileCache(exportImageTileParams, "\\path\\to\\file.tpk");
    
    
    
    TileCache exportImageTileCacheResult = await exportImageTilesJob.GetResultAsync();
    
    ArcGISTiledLayer imageTiledLayer = new ArcGISTiledLayer(exportImageTileCacheResult);
    
    
    
    TileCache offlineTileCache = new TileCache("\\path\\to\\file.tpk");
    ArcGISTiledLayer reopenedImagedTileLayer = new ArcGISTiledLayer(offlineTileCache);
  3. 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 .NET APIArcGIS Android APIArcGIS iOS APIArcGIS Java APIArcGIS Qt API (C++)ArcGIS Qt API (QML)
                                                                                               
    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
    // test data for convenience only
    Uri featureServiceUrl = new Uri("https://services2.arcgis.com/ZQgQTuoyBrtmoGdP/arcgis/rest/services/US_Bridges/FeatureServer");
    Envelope areaOfInterest = new Envelope(new MapPoint(-118.542587, 34.391663, SpatialReferences.Wgs84), 1, 1);
    areaOfInterest = (Envelope)GeometryEngine.Project(areaOfInterest, SpatialReferences.WebMercator);
    PortalItem hostedItem = await PortalItem.CreateAsync(await ArcGISPortal.CreateAsync(), "ba99a4a4f5ce48debbeca6713e051f1e");
    Uri imageTileUrl = new Uri("https://ibasemaps-api.arcgis.com/arcgis/rest/services/World_Imagery/MapServer");
    // Feature Service Snippets
    
    GeodatabaseSyncTask geodatabaseSyncTask = await GeodatabaseSyncTask.CreateAsync(featureServiceUrl);
    
    
    
    GenerateGeodatabaseParameters gdbParams = await geodatabaseSyncTask.CreateDefaultGenerateGeodatabaseParametersAsync(areaOfInterest);
    
    GenerateGeodatabaseJob generateJob = geodatabaseSyncTask.GenerateGeodatabase(gdbParams, "path\\to\\file.geodatabase");
    
    
    
    Geodatabase generateResult = await generateJob.GetResultAsync();
    
    
    
    Geodatabase offlineGeodatabase = await Geodatabase.OpenAsync("path\\to\\file.geodatabase");
    
    
    
    Uri serviceUrl = offlineGeodatabase.Source;
    
    GeodatabaseSyncTask gdbSyncTask = await GeodatabaseSyncTask.CreateAsync(serviceUrl);
    
    
    
    SyncGeodatabaseParameters offlineSyncParams = await gdbSyncTask.CreateDefaultSyncGeodatabaseParametersAsync(offlineGeodatabase);
    
    SyncGeodatabaseJob syncJob = gdbSyncTask.SyncGeodatabase(offlineSyncParams, offlineGeodatabase);
    
    
    
    IReadOnlyList<SyncLayerResult> syncResult = await syncJob.GetResultAsync();
    
    if (syncJob.Status != Esri.ArcGISRuntime.Tasks.JobStatus.Succeeded)
    {
        // Handle errors
    }
    
    
    
    // Vector tile snippets
    
    ExportVectorTilesTask exportVectorTilesTask = await ExportVectorTilesTask.CreateAsync(vectorServiceUri);
    
    
    
    ExportVectorTilesParameters exportVectorTilesParams = await exportVectorTilesTask.CreateDefaultExportVectorTilesParametersAsync(areaOfInterest, 0);
    ExportVectorTilesJob exportVectorTilesJob = exportVectorTilesTask.ExportVectorTiles(exportVectorTilesParams, "path\\to\\file.vtpk", "\\path\\to\\cache\\dir");
    
    
    
    ExportVectorTilesResult vectorExportResult = await exportVectorTilesJob.GetResultAsync();
    ArcGISVectorTiledLayer vectorTileLayer = new ArcGISVectorTiledLayer(vectorExportResult.VectorTileCache, vectorExportResult.ItemResourceCache);
    
    
    
    VectorTileCache vectorTileCache = await VectorTileCache.CreateAsync("\\path\\to\\file.vtpk");
    ItemResourceCache itemResourceCache = new ItemResourceCache("\\path\\to\\cache\\dir");
    ArcGISVectorTiledLayer offlineVectorTileLayer = new ArcGISVectorTiledLayer(vectorTileCache, itemResourceCache);
    
    
    // Image tile snippets
    
    ExportTileCacheTask exportImageTilesTask = await ExportTileCacheTask.CreateAsync(imageTileUrl);
    
    
    
    ExportTileCacheParameters exportImageTileParams = await exportImageTilesTask.CreateDefaultExportTileCacheParametersAsync(
        areaOfInterest: areaOfInterest,
        minScale: 500_000_000,
        maxScale: 10_000_000);
    
    ExportTileCacheJob exportImageTilesJob = exportImageTilesTask.ExportTileCache(exportImageTileParams, "\\path\\to\\file.tpk");
    
    
    
    TileCache exportImageTileCacheResult = await exportImageTilesJob.GetResultAsync();
    
    ArcGISTiledLayer imageTiledLayer = new ArcGISTiledLayer(exportImageTileCacheResult);
    
    
    
    TileCache offlineTileCache = new TileCache("\\path\\to\\file.tpk");
    ArcGISTiledLayer reopenedImagedTileLayer = new ArcGISTiledLayer(offlineTileCache);

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.

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 .NET APIArcGIS Android APIArcGIS iOS APIArcGIS Java APIArcGIS Qt API (C++)ArcGIS Qt API (QML)
                        
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 .NET APIArcGIS Android APIArcGIS iOS APIArcGIS Java APIArcGIS Qt API (C++)ArcGIS Qt API (QML)
                          
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);

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