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.
Tile packages are new and only available from ArcGIS 10.1 onwards.
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
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 -
- just the name of the package (omitting the *.tpk extension)
- or the full path to the tile package (including the *.tpk extension)
The following layer can displays map contents from a tile package named "WIldlifeHabitat.tpk".
AGSLocalTiledLayer* layer = [AGSLocalTiledLayer localTiledLayerWithName:@"WildlifeHabitat"];
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.
NSString* path = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"MyBundle.bundle/WildlifeHabitat.tpk"];
AGSLocalTiledLayer* layer = [AGSLocalTiledLayer localTiledLayerWithPath:path];