Skip To Content

ArcGIS Local Tiled layer

In this topic

An ArcGIS Local Tiled layer displays map content from a tile package that's available on the device. The layer can continue to display map content even when the device does not have any network connectivity, because all the map content is available locally in the tile package.

Tile packages

Tile packages (*.tpk) are a great way to bundle your map into a single file that can be used on a variety of mobile devices and desktops and easily shared with colleagues, customers, or coworkers. A tile package contains a collection of tiles representing your map content, along with any associated metadata, compressed and stored using the ArcGIS compact cache format.

Note:

Tile packages are only available at ArcGIS 10.1 and later.

Learn more about tile packages

Deploying tile packages

Once you've created or received a tile package, there are two ways you can deploy it to an iOS device to use with your application: included in the application and through iTunes file sharing.

1.Included in the application

To include the tile package in your application, you need to add the package to your application's XCode project. When you build your application, XCode copies the package to the application bundle. When a user subsequently installs your application on their device, either through the App Store or through ITunes, the tile package is installed as part of the application.

Advantages

  • Simple deployment—The user just needs to install the application. The application comes bundled with the tile package(s) it needs.
  • Simple to upgrade—When you need to update the tile package(s), you can roll out a new version of the application containing the new package(s). You can take advantage of the App Store infrastructure to notify users that a new version is available, and users will most likely be familiar with the workflow of upgrading an application.

Disadvantages

  • A new version of the application will need to be released to update the tile package(s) even if there is no new functionality or quality improvements in the application itself. This may require the usual rounds of stabilization testing, regression testing, and so on, before releasing the update.
  • Large tile packages increase the size of the application, and you may quickly run into the maximum size limits imposed on iOS applications. For more information on the limits, check the App Size Tips section of the ITunes Connect Developer Guide.

2. Through iTunes file sharing

In this scenario, the tile package is not bundled with the application and is thus not automatically copied to the device when installing the application. Instead, a user needs to manually copy the package to the application's shared folder through iTunes file sharing after installing the application.

Learn more about iTunes file sharing

Note:

To enable file sharing for your application, you must set the UIFileSharingEnabled key (displayed as "Application supports iTunes file sharing") to true in the application's Info.plist file. Any files copied through file sharing are made available in the Documents directory of the application. For more information about the iOS file system, see the Apple File System Programming Guide.

Advantages

  • Flexible—Users can update, delete, and add tile packages to the application's shared directory without having to update the application.
  • Smaller application size—Because tile packages are not contained in the application bundle, the size of the tile packages does not have a bearing on the size of the application. Thus, you can use large packages without worrying about running into size limits imposed on the application by Apple.

Disadvantages

Post installation steps required—After installing the application, users need to plug-in their iOS device to a computer containing iTunes and manually copy the tile packages to the application's shared folder on the device. This can be cumbersome and can pose challenges in (a) an enterprise context where users may not have access to a computer containing iTunes, or (b) a consumer context where the end user may not have access to or even know what a tile package is.

Creating the layer

To create a Local Tiled layer, you need to instantiate an object of the AGSLocalTiledLayer class. When instantiating the object, you have the option of providing one of the following:

  • The name of the package (omitting the *.tpk extension)
  • The full path to the tile package (including the *.tpk extension)
If you provide just the name, the layer will first check if the package is included in the application bundle. When looking inside the application bundle, the layer will recursively look inside both logical groups and physical folders. If it doesn't find a package inside the bundle, it will then check the application's shared documents directory.

The following layer displays map contents from a tile package named WIldlifeHabitat.tpk:

let layer = AGSLocalTiledLayer(name: "WildlifeHabitat")
The package can be within the application bundle (either nested inside a logical group or a physical folder), or it can be in the application's shared documents directory.

A tile package nested within a logical group in the application bundle
A tile package nested within a logical group in the application bundle
A tile package nested within a physical folder in the application bundle
A tile package nested within a physical folder in the application bundle
A tile package in the application's shared directory
A tile package in the application's shared directory

If the layer cannot find the package by name, for example, if the package is nested inside a custom bundle, you can provide the full path of the package to the layer as follows:

A tile package within a bundle in the application bundle
A tile package within a bundle in the application bundle
let path = NSBundle.mainBundle().resourcePath.stringByAppendingPathComponent("MyBundle.bundle/WildlifeHabitat.tpk")
let layer = AGSLocalTiledLayer(path: path)

See also

Local Tiled layer sample