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 (*.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.
Tile packages are only available at ArcGIS 10.1 and later.
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.
- 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.
- 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.
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.
- 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.
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)
The following layer displays map contents from a tile package named WIldlifeHabitat.tpk:
AGSLocalTiledLayer* layer = [AGSLocalTiledLayer localTiledLayerWithName:@"WildlifeHabitat"];
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:
NSString* path = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"MyBundle.bundle/WildlifeHabitat.tpk"];
AGSLocalTiledLayer* layer = [AGSLocalTiledLayer localTiledLayerWithPath:path];