One of the most effective ways to speed the performance of web and mobile apps is to pre-draw some or all of the map layers at various scales and save the images in a cache. These images are often called tiles due to their small square shape and the way that they tessellate to form a complete map image.
This post provides an overview of the different ways to create and use tiles with ArcGIS. It also gives the appropriate circumstances for each workflow.
Deciding how to host the tiles
The first thing you need to decide is where you will host the tiles after they are built. The following are the most common choices:
- Host the tiles on your own ArcGIS Server site. You host the tiles using your own hardware and software. The tiles are exposed through an ArcGIS Server map or image service that advertizes its cache to client devices. Clients make web service calls to request the needed rows and columns to fit the map view.
- Host the tiles on ArcGIS Online. You purchase a subscription to ArcGIS Online and 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.
- Host the tiles on Portal for ArcGIS. You implement Portal for ArcGIS so that 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 Server site is configured on the back end to create and host the tiles. The ability of Portal for ArcGIS to host tiled map services is coming later in 2013.
- Send the tiles to a mobile device. To support mobile apps that may not always be connected to the Internet, you create a special file called a tile package that contains your cache. You transfer this file to the mobile device bundled with the app download or as a separate download. The app can then take advantage of the locally stored tiles when it displays a map.
The choice you make about where to host the tiles may affect the hardware, software, and techniques you use to build the tiles. Following are some options for building the tiles in each scenario.
Building tiles for your own ArcGIS Server site
If you’re hosting your tiles with ArcGIS for Server, then you also build the tiles using ArcGIS for Server. You maintain full control over all hardware and software in the configuration, although you might 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 of the Server toolbox. The Service Editor window in ArcMap gives you an easy user interface for defining and building a cache. However, it’s important to understand that the Service Editor still uses the Caching toolset behind the scenes.
The Caching tools work with both map and image services, allowing you to create tiles from your map documents and large imagery collections.
Building tiles for ArcGIS Online hosted services
If you’ve decided to host your 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.
Building the tiles in ArcGIS Online
If you decide to build the tiles in ArcGIS Online, you use the File > Share As > Service wizard in ArcMap to define your cache. Building tiles in ArcGIS Online incurs an extra fee. The more tiles you build, the more credits you are charged. However, an advantage of building tiles in ArcGIS Online is that you do not have to procure or manage the hardware.
Building the tiles locally using ArcGIS for Server or ArcGIS for Desktop
If you want to use your own computing power to build the tiles instead of paying ArcGIS Online credits, you can build the tiles locally and then upload them to ArcGIS Online. This is accomplished through a special file called a tile package that contains all the tiles. You can upload a tile package to ArcGIS Online and expose it as a tiled map service.
Building tile packages with ArcGIS for Server
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 as described in the previous section.
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.
The advantage of using ArcGIS for Server to build the tiles is your ability to scale out the computing power dedicated toward the job. You can also build the tiles asynchronously so that you can continue using ArcGIS for other things.
Building tile packages with ArcGIS for Desktop
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 you don’t see this option available, you must 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. If your tile package is small (less than 1 GB) you can alternatively use the Add Item button in ArcGIS Online.
Publishing your uploaded tiles as an ArcGIS Online service
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 in 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 wide of an audience as you desire.
Once the service is published, you can delete the original tile package to reduce storage costs.
Building tiles for portal hosted services
When you publish tiled map services to Portal for ArcGIS, the tiles are generated by an ArcGIS Server site that has been registered with the portal. ArcMap gives you a simplified user interface for publishing the map service and defining and building the cache. Context menu items on your portal connection in the Catalog tree allow you to access caching tools for finer-grained control of your jobs.
Alternatively, you can use the Tile Cache toolset or the File > Share As > Tile Package workflows as described above 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 once.
The ability of Portal for ArcGIS to host tiled map services is coming later in 2013.
Building tiles for mobile apps
To build tiles for occasionally connected mobile apps, you must create a tile package. You can do this using either ArcGIS for Server or ArcGIS for Desktop tools as described in the previous sections; 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 app 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 app. 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.
Contributed by Sterling Quinn of the ArcGIS for Server software development team