Download the Image Boundary Polygon
This step-by-step guide will show you how to use a mosaic dataset in order to create a tile cache from an existing web service. It’s always a good idea to check the licencing of the data before you create a tile cache using this method.
The web service I will be using is an image service hosted by the Aerial Photography Field Office (APFO) which is a division of the Farm Service Agency (FSA), of the United States Department of Agriculture (USDA). This image service provides 1-meter aerial imagery from the National Agriculture Imagery Program (NAIP) for the United States. In this guide, I will be creating the tile cache for an area in Oregon, but you can follow along using any state you choose.
The tile cache that is produced could then be hosted from your own server, or just used locally on a computer and consumed through ArcMap (very handy for offline environments, such as a field machine). Creating a local tile cache of aerial imagery greatly increases performance because ArcMap does not need to hit an external server each time the user zooms or pans.
The first step is to add the web service we will be using as a GIS Server in ArcCatalog. So, open ArcCatalog and in the Catalog Tree window, expand GIS Servers and double click Add ArcGIS Server.
Leave the radial on Use GIS Services and click Next.
Enter http://gis.apfo.usda.gov/arcgis for the Server URL and click Finish.
The server will then be added under GIS Servers. The next step is to create a geodatabase that will hold the mosaic dataset. So, create a file geodatabase named NAIP_Imagery.
Now, we can create the mosaic dataset. Open the NAIP_Imagery geodatabase and right click in the white space and go to New ——> Mosaic Dataset…
This will open the Create Mosaic Dataset tool. For the Mosaic Dataset name put NAIP_Imagery and for the Coordinate System put NAD_1983_StatePlane_Oregon_North_FIPS_3601_Feet. This coordinate system can be found by searching for the WKID 102726. Click OK to create the mosaic dataset.
After the tool finishes, we need to add our image service to the mosaic dataset. Right click on the mosiac dataset and click Add Rasters…
This will open the Add Rasters to Mosaic Dataset tool. For the Raster Type select Image Service. Then under Input Data click the folder icon and browse to the GIS Servers.
Double click on the server we added at the beginning and then open the NAIP folder. Next, find the image service named Oregon_2012_1m_NC and click Add.
Finally, uncheck the box next to Update Boundary at the bottom, and then click OK to add the image service raster to the mosaic dataset.
Now, we need to create a new polygon feature class called Image_Boundary. This will be used to create the boundary for the tile cache. The larger the polygon area, the larger the tile cache will be.
(If you’re following along, there’s a zip file to download at the top of this page containing the Image_Boundary polygon I used for this example)
So, in ArcCatalog, create a new polygon feature class named Image_Boundary inside the NAIP_Imagery file geodatabase. Use the same coordinate system as the mosaic dataset, which for this example is NAD 1983 StatePlane Oregon North FIPS 3601 Feet. You do not need to add any fields, so all other options can be left as default.
Next, open ArcMap and add the NAIP_Imagery mosaic dataset and the Image_Boundary polygon. If the mosaic dataset was created correctly, you should see aerial imagery for the state of Oregon.
Now, we need to zoom into the area that the tile cache will be generated for. I’m going to create a tile cache for an area around downtown Portland.
So, start an edit session and using the Image_Boundary feature class create a polygon around the area that the tile cache will be generated for. Save your edits and stop editing and close ArcMap.
The next step is to use the Generate Tile Cache Tiling Scheme tool (ArcToolbox: Data Management tools –> Tile Cache –> Generate Tile Cache Tiling Scheme). The output of this tool will be used when we create the tile cache. It allows you to use your own coordinate system and set your own scale levels for the tile cache.
Open the tool and for the Input Data Source select the NAIP_Imagery mosaic dataset. The output of this tool is an XML file. So, for the Output Tiling Scheme browse to a folder and save it as TileCacheSettings.xml. Under number of scales enter 7. This will auto-populate 7 different scale levels. I will be using the defaults for this example, but if you’re creating a tile cache for your own area you will want to put some thought into the different scale levels. The more larger scale levels you have, the larger the tile cache will be. Click OK to create the tiling scheme.
Next, we need to update the Footprint and Boundary of the NAIP_Imagery mosaic dataset with the Image_Boundary polygon we previously created. In ArcCatalog, right click on the mosaic dataset and go to Modify ——> Import Footprint or Boundary…
This will open the Import Mosaic Dataset Geometry tool. For the Target Feature Class select Footprint, and select OBJECTID as the Target Join Field. For the Input Feature Class select the Image_Boundary polygon feature class, and select OBJECTID as the Input Join Field. When the tool is finished, open it again, but change the Target Feature Class to Boundary this time and run the tool again.
When the tool is finished, open ArcMap and add the NAIP_Imagery mosaic dataset. It should no longer show the entire state of Oregon. It should now only show aerial imagery for the area within the Image_Boundary polygon we created and imported for the Footprint and Boundary.
Now, we need to create the tile cache! In ArcCatalog, right click on the NAIP_Imagery mosaic dataset and go to Generate Tile Cache… This will open the Tile Cache window. For the Tile Cache Name, select a folder where the tile cache should be saved.
Next, click on Tile Format. The Tiling Scheme defaults to ArcGIS Online/Bing/Google Maps. If you use this scheme, the scale levels are set for you automatically and the output tile cache will be in the Web Mercator coordinate system. If you want to use your own coordinate system and scale levels, you must create your own tiling scheme.
So, change the Tiling Scheme to “A tiling scheme file” and select the TileCacheSettings.xml file we previously created. I’ve noticed that the Approximate cache size is not very accurate, so don’t let it alarm you. Click Analyze and make sure there are no errors. If there are errors, fix them before Generating the tile cache. If no errors are returned, click Generate.
**Warning**
The tile cache for this example is greater than 3GB. If you have been following along, you may want to end the process here, and create the tile cache for your own area.
The tile cache will now begin generating. This step could take anywhere from an hour to a few days depending on the size of the area to be cached, and connection speeds. But, the end result is worth the wait!
When the tile cache is finished generating, open ArcMap. Browse to the folder where the tile cache was saved and add it to the map. You now have a tile cache that was created from an existing web service! This tile cache can be used offline in a disconnected environment and will perform very well.
If you found this guide useful, please share it with others! If you have any questions or comments, please leave them below.
This is great and will be very handy for me in future when doing field work where there is no internet connection! Thanks!
Hi Hidi- thanks for the comment! Yes, this is especially useful when in an offline environment. Have fun!
Ian, thanks for posting this. This is helpful and easy to follow. However, I haven’t had much luck in setting up a mosaic dataset for esri World Imagery. I’ve set up the tiles for, I think, a manageable footprint (20 by 50 mile rectangle) and with only one scale (1:4000) but when I generate the tile cache it never finishes even after a couple of days. Am I missing something or am I just not patient enough?
Again, thanks for posting and for any help you can offer.
Vince
Vince, thanks for the comment. I’d say it’s possible that it just hasn’t finished caching yet.
I would suggest checking the properties of the folder where you saved the tile cache (should end in _cache) over a period of a couple minutes to see if the size is still increasing. If the size is increasing, then it’s just not finished yet.
Otherwise, you might try testing a smaller area to see if it completes.