Deploy local offline data

Your app may need data to be loaded onto your device rather that getting it from a service at the time it is needed. Taking your data offline allows you to access it without a network connection. The needed data may have been authored using ArcGIS Desktop, and also may include data from other sources. There are three common workflows that you can use to deploy data that your app can use offline. This topic describes these workflows.

Sideload data

Sideloading means to use a tool to copy your data to a known location on your device before using your app, and then use the ArcGIS QML Extras plug-in to determine at run time where that location is.

To sideload data to your device, follow these steps:

  1. Author your tile packages, geodatabases, offline locators, offline network datasets, or mobile map packages in ArcGIS Desktop.
  2. Using a file explorer tool (for example, ADB/Android File Transfer for Android, iTunes for iOS, and the native file explorers for each desktop platform), copy the data to the specified data location.
  3. When you reference these files in QML code, use the ArcGIS Extras plug-in to refer to a location where the data will be stored relative to where your app resides on the device.
  4. Each operating system has a similar but slightly different data location:

    • Android location is /sdcard/ArcGIS/Runtime/Data.
    • iOS location is <your_app>/Documents/ArcGIS/Runtime/Data.
    • Mac location is ~/ArcGIS/Runtime/Data.
    • Windows location is %userprofile%\ArcGIS\Runtime\Data.
    • Linux location is $HOME/ArcGIS/Runtime/Data.

    By storing data in these locations and using the System.userHomeFolder function, you can be sure that your app will be able to read and write data on any deployed operating system.

    When deploying to iOS, you must modify the .plist file for the template provided with the SDK to enable file sharing with your app. Modify the .plist file to change UIFileSharingEnabled from FALSE to TRUE. To use this functionality, plug in your device, open iTunes and in it open your device, click Apps, and scroll down to the bottom. Find your app, and use the Add dialog box to add your data. If you are using folders, make sure to create a clone of the structure you want, and add the topmost folder. This will copy everything to your app's Documents folder.

Bundle data as a Qt resource

Although Qt supports reading from embedded resources, ArcGIS Runtime SDK uses standard C file I/O which does not support Qt resources. Therefore when you bundle your data with your app for deployment, you must copy the data from the Qt resource file (.qrc file) to a working data location on the device before you can use it. The ArcGIS QML Extras plug-in contains a copyFile function that copies files from the .qrc file to a working data location.

This workflow is good for smaller data files such as small geodatabases or tile packages. For performance and app size reasons, this workflow is not recommended for large data files.

Download data at run time

You can host your data on ArcGIS Online or ArcGIS Enterprise, and use the API to download the data as a portal item, storing it in a working data location. Use the ArcGIS Extras plug-in to refer to the working data location relative to where your app resides on the device. After downloading ands storing the data locally, your app can access the data without a network connection.

Additional data resources

Depending on your app's needs, you may need some additional data resources.

Projection engine files

If your app is using grid-based transformations, deploy the required Projection Engine data files to the device by side-loading them or downloading them directly on the device.

Note:
These Projection Engine data files are available for download from the downloads page on developers.arcgis.com (requires you to log in).

ENC (electronic navigational charts) style directory

If your application displays ENC layers, deploy the hydrography directory, available for download from the downloads page on developers.arcgis.com (requires you to log in).