Skip To Content

Create an offline map

In this topic

You can provide offline maps to users so they can be productive when their network connectivity is poor or nonexistent. To create offline maps, you create geodatabases and tile caches and then build layers from those, as described in this topic.

You can add capabilities for the following:

  • Viewing basemaps (also known as tiled layers, created from tile caches).
  • Editing operational data (also known as feature data and vector data). This includes querying and editing the location, shape, attributes, related tables, and attachments of features.
  • Syncing edits when online again (upload their edits and/or pull down only the updated features that others have edited), if your data is service based.
  • Performing blazing fast searches for locations (geocode and reverse geocode) and routes. For details, see Locator Task and Routing Task.


An app licensed at the Basic level can include viewing offline basemaps and viewing offline feature data contained in a geodatabase. You must license your app at the Standard level if it includes any of the following functionality: offline editing, syncing offline edits with an upload, offline routing, and offline geocoding. See License your app for more information on license levels.

Offline patterns

Two main patterns are available for ArcGIS Runtime offline:

  • Services pattern—Best for supporting a large number of users, this pattern allows multiple offline users to edit the same data layers and sync edits later, when online.
  • Desktop pattern—Best for supporting applications with read-only data that requires periodic updates.

Services pattern

The services pattern is best for supporting a large number of users. This pattern allows multiple offline users to edit the same data layers and sync edits later, when online.

For operational data, you can use a sync-enabled feature service from ArcGIS for Server, ArcGIS Online, or Portal for ArcGIS to generate the geodatabase for offline use. Through the synchronization process, you can control whether a user can upload their changes, download others' changes, or both. This allows the application to have an up-to-date view of the data. When more than one user is editing the same feature and the edits conflict, the last edit synchronized to the service overrides the others.

In one workflow, sometimes referred to as a pre-planned workflow, you generate the geodatabase once and load it onto your users' devices. This workflow requires you to register a geodatabase.

For basemap data, ArcGIS tiled map services and ArcGIS Online basemaps allow for the on-demand creation of tile caches, letting you take your basemaps offline.

Desktop pattern

The desktop pattern, which allows a user to consume ArcGIS Runtime content created in ArcGIS for Desktop, is best for supporting apps with read-only data requiring periodic updates. This content can include features, tabular data, tile caches, network datasets for directions, and locators. For more information on creating ArcGIS Runtime content using ArcGIS for Desktop, see Creating ArcGIS Runtime content.

Include operational data

You can prepare operational data for offline use in one of two ways:

  • Generate a geodatabase from a sync-enabled feature service using the API (services pattern).
  • Generate a geodatabase using ArcGIS for Desktop (desktop pattern).

This section describes preparing operational data and adding it to your app.

Generate a geodatabase from a sync-enabled feature service

To generate a geodatabase for offline use, you need a feature service from ArcGIS 10.2.2 for Server or later or a service from ArcGIS Online. The feature service must be enabled for sync. You can publish feature services using ArcGIS for Desktop or create feature services hosted on ArcGIS Online using the ArcGIS for Developers website. To enable sync for a feature service in ArcGIS Online, edit the feature service item in ArcGIS Online, and check the Sync check box. Once you have a sync-enabled feature service, you can generate a geodatabase for your area of interest; this creates a copy of your features that you can work with offline.

To generate a geodatabase for offline use:

  1. Specify parameters—Before generating a geodatabase, specify parameters for its creation, such as the area of interest.
  2. Generate a geodatabase—Request and download copies using the methods on the AGSGDBSyncTaskclass.
  3. Register a geodatabase—After generating the geodatabase you may need to register it.

Specify parameters

When generating a geodatabase for offline use, you supply parameters allowing you to control the following:

  • The layers to include in the generated geodatabase
  • The extent of the generated geodatabase (and the spatial reference of this extent)—The extent of the geodatabase requested from the ArcGIS feature service is typically an envelope. However, point, line, and polygon (including multipart) geometries are supported, allowing for more complex data extractions to be defined. Regardless of the geometry type, features that intersect with the supplied geometry are extracted.
  • The spatial reference of the generated geodatabase
  • Whether or not to include feature attachments in the generated geodatabase
  • The synchronization model for the geodatabase—The synchronization model controls how edits made to the geodatabase in the field are applied back to the feature service during synchronization. The model supported is defined by the data that was used to create the sync-enabled feature service. If the data is non-versioned, the synchronization model is per layer. This is the most flexible model, allowing you to synchronize on a layer-by-layer basis, based on the layers you specify. If the data is versioned, the synchronization model is per geodatabase. This synchronizes the entire geodatabase, including all layers and tables at once.
  • Whether to only include a subset of the features in the specified extent, by specifying layer queries to filter features by attribute values

Generate a geodatabase

To request a geodatabase from a sync-enabled feature service for your area of interest, use the AGSGDBSyncTaskclass for this, after setting up your AGSGDBGenerateParameters for the task.

The following code snippet shows how this can be achieved:

@property (strong,nonatomic) AGSGDBSyncTask *geodatabaseTask;
@property (nonatomic,strong) id<AGSCancellable> geodatabaseJob;
@property (strong, nonatomic) AGSGDBGenerateParameters *generateParameters;
@property (strong) IBOutlet AGSMapView *mapView;
@property (strong) AGSGDBFeatureTable *localFeatureTable;
@property (strong) AGSFeatureTableLayer *localFeatureTableLayer;

//Set parameters for the feature extent
//The Ids of the feature layers
//The synchronization model
//The output spatial reference
self.generateParameters = [[AGSGDBGenerateParameters alloc]initWithExtent:anAreaOfInterest layerIDs:@[@0]];
self.generateParameters.syncModel = AGSGDBSyncModelPerLayer;
self.generateParameters.outSpatialReference = self.mapView.spatialReference;

//Create the geodatabase task
self.geodatabaseTask = 
 [[AGSGDBSyncTask alloc] initWithURL:[NSURL URLWithString:kFeatureServiceURL] credential:nil];

//Use a weak variable for self within the blocks
__weak typeof(self) *weakSelf = self;

//If the geodatabase task loads then proceed to 
//generate and download the geodatabase
self.geodatabaseTask.loadCompletion = ^(NSError *error){
 if (error) {
  NSLog(@"AGSGDBSyncTask failed to load!");
 else {

   //Generate the geodatabase (with parameters)
   weakSelf.geodatabaseJob = 

     //Status block - provides feedback form the asynchronous job
     status:^(AGSResumableTaskJobStatus status, NSDictionary *userInfo){
      NSLog(@"Status: %@", status);

     //Completion block - executes when the job has completed.
     //This code creates a AGSFeatureTableLayer from the first table in the
     //returned geodatabase.
     completion:^(AGSGDBGeodatabase *geodatabase, NSError *error){
      if (error) {
       NSLog(@"Error fetching geodatabase:%@",error);
      else {
       weakSelf.localFeatureTable = [[geodatabase featureTables] objectAtIndex:0];
       weakSelf.localFeatureTableLayer = [[AGSFeatureTableLayer alloc] initWithFeatureTable:weakSelf.localFeatureTable];
       weakSelf.localFeatureTableLayer.delegate = weakSelf;
       [weakSelf.mapView addMapLayer:weakSelf.localFeatureTableLayer withName:@"Offline Feature Layer"]; 

Your geodatabase should now be on your local machine or device.

Register a geodatabase in a pre-planned workflow

In a services pattern workflow known as a pre-planned workflow, you generate the geodatabase once and load copies of it onto each user's device.

This workflow has the following benefits:

  • Allows you to control which maps/geodatabase your users can select from. You can pre-load your maps/geodatabase onto your users' devices.
  • Allows you to schedule the geodatabase generation for off-peak hours.
  • Reduces the load on the server. Multiple clients aren't generating a geodatabase for the same area because you've generated it for them.

If you use this workflow, you must register the geodatabase (copy) on each device that uses it. For details and important tips on registering and unregistering geodatabases, see Register a geodatabase in a pre-planned workflow in "Sync offline edits."

Generate a geodatabase from ArcGIS for Desktop

Use ArcGIS 10.2.1 for Desktop or later to generate a geodatabase using the Share as > ArcGIS Runtime Content menu item as described in the ArcGIS help topic Creating ArcGIS Runtime content.

Add geodatabase content to your app

  1. Open the geodatabase using the class, which takes the path to the geodatabase in the class constructor. This class has methods that let you list the feature tables and properties in the geodatabase file.

    AGSGDBGeodatabase *gdb = [AGSGDBGeodatabase alloc]initWithPath:thePathString error:(NSError *error);

  2. A feature layer is used to display features on a map. To create a feature layer from a geodatabase, first, use the geodatabase to retrieve a feature table, and next, create a feature layer from that feature table. The geodatabase potentially contains several geodatabase feature tables, depending on the layers you requested during geodatabase generation. If the geodatabase was created from a sync-enabled feature service, you can retrieve a feature table by ID corresponding to the feature service's layer ID.

    @property (strong,nonatomic) AGSGDBFeatureTable *localFeatureTable;
    @property (strong,nonatomic) AGSFeatureTableLayer *localFeatureTableLayer;
    localFeatureTable = [[geodatabase featureTables] objectAtIndex:0];
    localFeatureTableLayer = [[AGSFeatureTableLayer alloc] initWithFeatureTable:localFeatureTable];
    localFeatureTableLayer.delegate = self;

  3. Add the feature layer to the map. Once the layer is added and initialized, your features display in the map.

    The features you will see in the map depend on the map extent displayed. If your features are not displaying, make sure you have panned or zoomed to the appropriate extent, and that the spatial reference of the geodatabase matches the spatial reference of the map. You can set the spatial reference of a geodatabase at generation time, as described in Generate a geodatabase from a feature service.

Your geodatabase content is added to the map.

Include a basemap

A basemap is a map layer that helps orient the user of the map. Typically it sits behind operational layers and shows roads and buildings to give context to the operational layer.

Create a basemap from a tiled service (download a basemap)

An offline copy of tiled map services can be requested so that a basemap is available when the application is working in an offline environment. These copies can be downloaded in the form of a tile package (.tpk file) by using the API's AGSExportTilecacheTaskclass. The map service used for this operation must support the creation of an offline tile cache; specifically, it must support the exportTiles operation that appears at the bottom of the service's HTML page.

When requesting a tile cache, define the following properties:

  • How the levels of detail (also known as LODs) for the tile cache should be specified, that is, using level IDs, scales, or resolutions
  • Levels, scales, or resolutions for the tile cache
  • Extent of the tile cache (this can be a polygon geometry, not just an envelope)
  • Spatial reference for the tile cache

For a list of ArcGIS Online basemaps that you can take offline, see Tiled Basemaps.

When creating an offline tile cache from a tiled service, consider the following:

  • The exportTiles operation used to generate tile caches is only available on ArcGIS 10.2.1 for Server or later services.
  • The time required to create a tile cache varies depending on the extent requested, the number of levels requested, the network connection speed, and so on. Try generating a smaller tile cache to get an idea of how long caching will take when planning a large offline data capture event.
  • When generating a tile cache from an ArcGIS Online basemap, there is a cap on the number of tiles you can download in one request, which is 100,000 tiles. Read more on this in the exportTiles REST documentation.
  • Organizations that use their own ArcGIS Server to host offline tile caching can configure the ArcGIS Server's maxExportTilesCount via the admin to change the default 100,000-cache tile cap.

Create a basemap using ArcGIS for Desktop

When you create a basemap using ArcGIS for Desktop, you can set the format, tiling schemes, and levels of detail. For details, see the online ArcGIS help topics How to create a tile package and About tile packages.

Related topics