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 Geocoding and Place Search and Find a route.


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 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. No matter what geometry you supply, you must also specify its spatial reference.
  • 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. Then, call the generateGeodatabase method on the GeodatabaseSyncTask. If the task completes successfully, you will get the path to the downloaded geodatabase in a callback.

The following code snippet shows how this can be achieved:

static GeodatabaseSyncTask gdbSyncTask;

   * Create the GeodatabaseTask from the feature service URL w/o credentials.
  private void downloadData(String url) {
    Log.i(TAG, "Create GeoDatabase");
    // create a dialog to update user on progress
    dialog =, "Download Data", "Create local runtime geodatabase");;

    // create the GeodatabaseTask
    gdbSyncTask = new GeodatabaseSyncTask(url, null);
    gdbSyncTask.fetchFeatureServiceInfo(new CallbackListener<FeatureServiceInfo>() {

      public void onError(Throwable arg0) {
        Log.e(TAG, "Error fetching FeatureServiceInfo");

      public void onCallback(FeatureServiceInfo fsInfo) {
        if (fsInfo.isSyncEnabled()) {


   * Set up parameters to pass the the submitTask() method. A
   * CallbackListener is used for the response.
  private static void createGeodatabase(FeatureServiceInfo featureServerInfo) {
    // set up the parameters to generate a geodatabase
    GenerateGeodatabaseParameters params = new GenerateGeodatabaseParameters(featureServerInfo, mMapView.getExtent(),

    // a callback which fires when the task has completed or failed.
    CallbackListener<String> gdbResponseCallback = new CallbackListener<String>() {
      public void onError(final Throwable e) {
        Log.e(TAG, "Error creating geodatabase");

      public void onCallback(String path) {
        Log.i(TAG, "Geodatabase is: " + path);
        // update map with local feature layer from geodatabase


    // a callback which updates when the status of the task changes
    GeodatabaseStatusCallback statusCallback = new GeodatabaseStatusCallback() {
      public void statusUpdated(GeodatabaseStatusInfo status) {
        Log.i(TAG, status.getStatus().toString());


    // create the fully qualified path for geodatabase file
    localGdbFilePath = createGeodatabaseFilePath();

    // get geodatabase based on params
    submitTask(params, localGdbFilePath, statusCallback, gdbResponseCallback);

   * Request database, poll server to get status, and download the file
  private static void submitTask(GenerateGeodatabaseParameters params, String file,
      GeodatabaseStatusCallback statusCallback, CallbackListener<String> gdbResponseCallback) {
    // submit task
    gdbSyncTask.generateGeodatabase(params, file, false, statusCallback, gdbResponseCallback);

   * Add feature layer from local geodatabase to map
  private static void updateFeatureLayer(String featureLayerPath) {
    // create a new geodatabase
    Geodatabase localGdb = null;
    try {
      localGdb = new Geodatabase(featureLayerPath);
    } catch (FileNotFoundException e) {

    // Geodatabase contains GdbFeatureTables representing attribute data
    // and/or spatial data. If GdbFeatureTable has geometry add it to
    // the MapView as a Feature Layer
    if (localGdb != null) {
      for (GeodatabaseFeatureTable gdbFeatureTable : localGdb.getGeodatabaseTables()) {
        if (gdbFeatureTable.hasGeometry())
          mMapView.addLayer(new FeatureLayer(gdbFeatureTable));
    // display the path to local geodatabase


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 Geodatabaseclass, 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.

    //Open the geodatabase file
    Geodatabase geodatabase = new Geodatabase("{/path/to/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.

    private GeodatabaseFeatureTable geodatabaseFeatureTable;
    //get the geodatabase feature table
    geodatabaseFeatureTable = geodatabase.getGeodatabaseFeatureTableByLayerId(0);
    //create a feature layer
    featureLayer = new FeatureLayer(geodatabaseFeatureTable);

  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.

  4. When you are done with the geodatabase, for example, when closing the application, call its dispose method. This ensures that file resources release and the database correctly closes.

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:

  • How the levels of detail (also known as LODs) for the tile cache should be specified; currently only level IDs are supported
  • Level IDs 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. Use the API's estimateTileCacheSize method on ExportTileCacheTask 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.

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