Workflows for Using and Building Hosted Cached Map Tiles
By Sterling Quinn of the ArcGIS for Server Development Team
This article as a PDF.
This article as a PDF.
One of the most effective ways to speed the performance of web and mobile applications is to predraw some or all of the map layers at various scales and save the images in a cache. Because of their small square shape and the way that they tessellate to form a complete map image, these images are often called tiles.
This is an overview of the different ways you can use tiles with ArcGIS and suggested workflows for building tiles. It highlights considerations that affect the appropriateness of each workflow. The first thing you need to decide is where you will host the tiles after they are built. The most common choices are to host the tiles on your own ArcGIS for Server site, on ArcGIS Online, or Portal for ArcGIS, or to send tiles to a mobile device.
On Your ArcGIS for Server Site
When you host the tiles using your hardware and software, they are exposed through an ArcGIS for Server map or image service that advertises its cache to client devices. Clients make web service calls to request the needed rows and columns to fit the map view.
On ArcGIS Online
When you purchase a subscription to ArcGIS Online, you can host your tiles on the cloud. The tiles are exposed through a basic REST web service that distributes the tiles to clients based on the rows and columns requested. You pay a monthly fee for tile storage.
On Portal for ArcGIS
The ability to host tiled map services on Portal for ArcGIS is coming later in 2013. If you implement Portal for ArcGIS, users in your organization can publish tiled services without directly accessing ArcGIS for Server. The portal is a website and content repository that behaves like ArcGIS Online, except your own ArcGIS for Server site is configured on the back end to create and host the tiles.
Send Tiles to a Mobile Device
To support mobile applications that may not always be connected to the Internet, you can create a special file called a tile package that contains your cache. You transfer this file to the mobile device bundled with the application download or as a separate download. The application can then take advantage of locally stored tiles when it displays a map.
Where you decide to host tiles may affect the hardware, software, and techniques you use when building tiles. Here are some considerations when using each approach to creating cached tiles.
Building Tiles for Your ArcGIS for Server Site
If you're hosting your tiles with ArcGIS for Server, you can also use ArcGIS for Server to build the tiles, maintaining full control over all hardware and software in the configuration. You might also choose to supplement your tile-building capacity with virtual machines that you've apportioned through Amazon Web Services.
All ArcGIS for Server caches are built using the Caching toolset in the Server toolbox. The Service Editor window in ArcMap provides an easy user interface for defining and building a cache. However, it's important to understand that the Service Editor is using the Caching toolset behind the scenes. The Caching tools work with both map and image services, so tiles can be created from map documents and large imagery collections.
Building Tiles for ArcGIS Online Hosted Services
If you host tiles on ArcGIS Online, you can either build the tiles in the ArcGIS Online cloud or build the tiles locally and transfer them to ArcGIS Online. To build the tiles on ArcGIS Online, choose File > Share As > Service in ArcMap. Use the wizard to define your cache. Building tiles on ArcGIS Online incurs an extra fee. The more tiles you build, the more credits you use. However, if you build tiles on ArcGIS Online, you do not have to procure or manage hardware.
Building Tiles Locally Using ArcGIS for Server or ArcGIS for Desktop
Instead of using ArcGIS Online credits, you can build the tiles locally and upload them to ArcGIS Online. This is accomplished using a tile package, a special file that contains all the tiles. You can upload a tile package to ArcGIS Online and expose it as a tiled map service.
You can use ArcGIS for Server to build tiles for a map or image service. This is done using the Caching toolset in the Server toolbox. Once you have the tiles, you can run the Export Tile Cache tool to get the tiles into a tile package. This tool is in the Tile Cache toolset in the Data Management toolbox. If you use ArcGIS for Server to build the tiles, you can scale out the computing power dedicated toward the job and build the tiles asynchronously so that you can continue using ArcGIS for other things at the same time.
If you don't have ArcGIS for Server, you can build tiles using ArcGIS for Desktop. The easiest way to do this for a small cache is to use the File > Share As > Tile Package option in ArcMap. This option reads the map, draws the tiles, packages them, and sends them to ArcGIS Online. (If this option is not available, enable the ArcGIS Runtime Tools from the ArcMap Options menu.)
A more appropriate way to build large caches with ArcGIS for Desktop is to use the Tile Cache toolset in the Data Management toolbox. At ArcGIS 10.1, these tools can build tiles for any single map layer containing a mosaic dataset or raster dataset. Later in 2013, they will be able to build tiles for the full map document.
The Tile Cache tools take advantage of multiple processor cores if they are available. They can also be automated using models or scripts. Typically, you'll use the Tile Cache tools in this order:
- Generate Tile Cache Tiling Scheme to define the tiling grid and image format.
- Manage Tile Cache to build the tiles.
- Export Tile Cache to create the tile package.
- Share Package (in the Package toolset) to upload the tiles onto ArcGIS Online. Alternatively, if your tile package is small (less than 1 GB), you can use the Add Item button on ArcGIS Online.
No matter how you create the tile package and upload it to ArcGIS Online, you must take the final step of publishing the tile package as a service. When you view the item details page of any tile package you own on ArcGIS Online, you can click the Publish button to unpack the tiles and host them as a web service. You can use ArcGIS Online sharing settings to expose the service to as many or as few people as you desire. Once the service is published, you can delete the original tile package to reduce your storage costs.
Building Tiles for Portal Hosted Services
The ability to host tiled map services on Portal for ArcGIS is coming later in 2013. When you publish tiled map services to Portal for ArcGIS, the tiles will be generated by an ArcGIS for Server site that has been registered with the portal. ArcMap provides a simplified user interface for publishing the map service and defining and building the cache. Context menu items on the portal connection in the Catalog tree allow you to access caching tools for finer-grained control of your jobs. Alternatively, you could use the Tile Cache toolset or use ArcGIS for Desktop and choose File > Share As > Tile Package to make a tile package, upload it to the portal, and then publish. This approach can reduce the load on the server, especially if many people are creating tiled services at the same time.
Building Tiles for Mobile Use
Building tiles for occasionally connected mobile applications requires a tile package. You can do this using either ArcGIS for Server or ArcGIS for Desktop tools as previously described. However, uploading the tile package to ArcGIS Online or a portal is not required. Instead, you bundle the tile package with the application download or provide it as a separate download that the application can retrieve later.
The ArcGIS Runtime SDKs for various mobile platforms all include an ArcGIS Local Tiled Layer class that can read tile packages. When creating tile packages that will be transferred to mobile devices, don't build any more tiles than are necessary for the application. This is an important rule for all tile caches, but mobile workflows are especially sensitive to application size. The Manage Tile Cache tool allows you to browse to an area of interest feature class that constrains the geographic area of tile creation.
For additional information, visit ArcGIS Resources to read blog posts and access help and forum posts.