ArcGIS Local Tiled Layer

An ArcGIS Local Tiled Layer displays map content from a tile package that is 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.

About Tile Packages

Tile packages (*.tpk) are a great way to bundle up your map into 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.

NoteNote:

Tile packages are new and only available from ArcGIS 10.1 onwards.

Learn more about tile packages.

Deploying Tile Packages

Once you have created or recieved a tile package, there are two ways you can deploy it to an iOS device to use with your application.

1.Included within the application

To include the tile package in your applicatoin, you need to add the package to your application's XCode project . When you build your application, XCode will then copy 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 will also be installed as part of the application.

Advantages

  • Simple deployment. The user needs to only install your 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, etc before releasing the update.
  • Large tile packages will in turn 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

NoteNote:

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, refer to Apple's 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 within the application bundle, the size of 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 over the tile packages to the application's shared folder on the device. This can be cumbersome and might 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 -

If you provide just the name, the layer will first check if the package is included in the application bundle itself. 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 can displays map contents from a tile package named "WIldlifeHabitat.tpk".

AGSLocalTiledLayer* layer = [AGSLocalTiledLayer localTiledLayerWithName:@"WildlifeHabitat"];
The package could 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 physical folder in the application bundle
A tile package in the application's shared directory

If the layer cannot find the package just by its 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
NSString* path = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"MyBundle.bundle/WildlifeHabitat.tpk"];
AGSLocalTiledLayer* layer = [AGSLocalTiledLayer localTiledLayerWithPath:path];

See Also

Local Tiled Layer Sample

5/9/2012