Skip To Content ArcGIS for Developers Sign In Dashboard

Create an offline map

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 and Search for places.


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, offline geocoding, and any use of the Local Server. 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.

ArcGIS Runtime SDKs for Java, .NET (Desktop), and WPF offer a third pattern to use offline maps: the local server pattern. It's recommended that you use the services or desktop pattern instead; however, be aware that these patterns do not contain some capabilities that the local server pattern does, such as offline geoprocessing.

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 GeodatabaseSyncTaskclass.
  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 GeodatabaseSyncTaskclass for this, after setting up your GenerateGeodatabaseParameters for the task.


Feature attachments, if supported by the feature service, are not included in the generated geodatabase by default. Set GenerateGeodatabaseParameters.ReturnAttachments to true if you want to include feature attachments in the output geodatabase. For information about using feature attachments in your ArcGIS Runtime app, see the Work with feature attachments topic.

The following code snippet shows how this can be achieved:

// provide a callback to execute when the GeodatabaseSyncTask completes (successfully or with an exception)
private async void GdbCompleteCallback(Esri.ArcGISRuntime.Tasks.Offline.GeodatabaseStatusInfo statusInfo, Exception ex)
    // if unsuccessful, report the exception and return
    if (ex != null)
        this.ReportStatus("An exception occured: " + ex.Message);

    // if successful, read the generated geodatabase from the server
    var client = new ArcGISHttpClient();
    var gdbStream = client.GetOrPostAsync(statusInfo.ResultUri, null);
    var geodatabasePath = System.IO.Path.Combine(@"C:\Temp\Cache", "WildlifeLocal.geodatabase");

    // create a local path for the geodatabase, if it doesn't already exist
    if (!System.IO.Directory.Exists(@"C:\Temp\Cache"))

    // write geodatabase to local location
    await Task.Factory.StartNew(async delegate
        using (var stream = System.IO.File.Create(geodatabasePath))
            await gdbStream.Result.Content.CopyToAsync(stream);
        MessageBox.Show("Offline database created at " + geodatabasePath);

// store a private variable to manage cancellation of the task
private CancellationTokenSource _syncCancellationTokenSource;

// call GenerateGeodatabaseAsync from a button click
private async void GetDataButton_Click(object sender, RoutedEventArgs e)
        // cancel if an earlier call was made
        if (_syncCancellationTokenSource != null)
        // get a cancellation token
        _syncCancellationTokenSource = new CancellationTokenSource();
        var cancelToken = _syncCancellationTokenSource.Token;

        // create a new GeodatabaseSyncTask with the uri of the feature server to pull from
        var uri = new Uri("");
        var gdbTask = new GeodatabaseSyncTask(uri);

        // create parameters for the task: layers and extent to include, out spatial reference, and sync model
        var layers = new List<int>(new int[3] { 0, 1, 2 });
        var extent = MyMapView.Extent;
        var gdbParams = new GenerateGeodatabaseParameters(layers, extent)
            OutSpatialReference = MyMapView.SpatialReference,
            SyncModel = SyncModel.PerLayer,
            ReturnAttachments = true

								// Create a System.Progress<T> object to report status as the task executes
        var progress = new Progress<GeodatabaseStatusInfo>();
        progress.ProgressChanged += (s, info) =>

        // call GenerateGeodatabaseAsync, pass in the parameters and the callback to execute when it's complete
        var gdbResult = await gdbTask.GenerateGeodatabaseAsync(gdbParams, GdbCompleteCallback, new TimeSpan(0,1,0), progress, cancelToken); 
    catch (Exception ex)
        MessageBox.Show("Unable to create offline database: " + ex.Message);

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 static OpenAsync method on the Geodatabaseclass, which takes the path to the geodatabase. This class has methods that let you list the feature tables and properties in the geodatabase file.

    // open the geodatabase file
    Geodatabase gdb = await Esri.ArcGISRuntime.Data.Geodatabase.OpenAsync(@"C:\Temp\Cache\WildlifeLocal.geodatabase");

  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.

    // get the first geodatabase feature table
    var gdbFeatureTable = gdb.FeatureTables.FirstOrDefault();
    //create a layer for the feature table
    var featureLayer = new FeatureLayer
                        ID = gdbFeatureTable.Name,
                        DisplayName = gdbFeatureTable.Name,
                        FeatureTable = gdbFeatureTable

  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) or compact cache by using the API's ExportTileCacheTaskclass. 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:

  • Tile cache format, that is, tile package or compact cache
  • Extent of the tile cache (this can be a polygon geometry, not just an envelope)
  • Spatial reference for the tile cache (defined on the extent geometry of the cache)
  • Minimum and maximum scale to include in the 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. Use the API's EstimateTileCacheSizeAsync method on the ExportTileCacheTask class to get the approximate size of a tile cache for a specific set of parameters. 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.

Tile package or compact cache?

Tile packages are the most convenient because the entire cache lives in a single .tpk file. However, the size of this file might be problematic for devices that enforce a limit on file size. If this is an issue, use compact caches instead. Compact caches store the same information as tile packages, but the data is stored in a structure of directories and files that are more suitable for some operating systems.

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.

Use a local elevation source

If you are creating a Scene for offline use, your app can consume locally available raster datasets on the client to define an elevation surface for the scene.

The following formats are supported for creating a local elevation source:

  • CIB1, 5, 10
  • DTED0, 1, 2
  • GeoPackage
  • GeoTIFF
  • HFA
  • HRE
  • IMG
  • JPEG
  • JPEG 2000
  • NITF
  • PNG
  • RPF
  • SRTM1, 2

See Provide a surface for a scene for more information.

Related topics