Building a Tile Cache
This section describes the requirements and procedure to build a tile cache into the client repository online in real time.
Tile caching is the process by which images are downloaded and saved to a cache for faster retrieval, thus improving performance of client applications. While navigating through areas of interest (AOIs), the client program can search for tiles at respective locations on the local disk without requesting WMTS every time. If the tiles are not available on the local disk for the specified region, the request can be sent to WMTS GetTile request and the tiles can be saved accordingly.
A client program can communicate with the WMTS server using the GetTile request for a set of valid tileRows and tileColumns at a given zoom level to build the Tile Cache. The client program has to request GetCapabilities from the WMTS server in order to determine what the WMTS server can do and what Features the WMTS server can provide. More specifically, in a typical WMTS Tile-Cache client/server interaction, the following steps can be followed.
Step 1: Build Tile Cache
Identify the tileRow, tileColumn range for the required AOI and request for GetTile at different zoom levels and required file formats to receive a Map Tile response. See Web Map Tile Service.
Step 2: GetTile Request
An example request for a tile is:
| https://evwhs.digitalglobe.com/mapservice/wmtsaccess?SERVICE=WMTS&VERSION=1.0.0&REQUEST=GetTile&LAYER=DigitalGlobe:ImageryTileService&FORMAT=image/jpeg&STYLE=&connectId=<CONNECTID>&TileMatrixSet=EPSG:3857&TileMatrix=EPSG:3857:<ZOOM_LEVEL>&TileRow=<TILE_ROW>&TileCol=<TILE_COLUMN> Note: Replace <CONNECTID> with the connectId provided by Maxar. Parameters are not required to be in the same order as shown above. Replace <TILE_ROW>, <TILE_COLUMN>, and <ZOOM_LEVEL> with the required values. |
The above URL contains the Base URL and parameters. The key parameter for this request is "request=GetTile" which fetches the tiles of WMTS and responds in the form of an image.
The Parameters required for the GetTile request are explained in GetTile.
Step 3: Caching GetTile Response
The response to a Tile Cache Request is a Map Tile in the requested format and projection. All WMTS tiles are 256x256 pixels; no other tile sizes are currently supported.
In the following GetTile output response image, you may note the values of tileRows and tileColumns at zoom level 16.
Tile Cache Response
On successful building, the tile bytes are received from a series of requests, which can be read through the respective file operations API of any programming language and can be saved to a local disk/required location.
Suggested Folder Structure For Saved Map Tiles
Sample Files Inside Folders
Assumptions
- Tile Cache QA/Error processing must be detected and raised by the user.
- A certain number of threads (simultaneous requests)are provided to the user and are allowed to access the system, which is reportable.
- The user may choose from two formats of metadata: tab-delimited or XML.
- The user should know the tiles' X,Y,Z values necessary to cover the landmass AOI down to zoom level 18.
- It is recommended to go no farther than zoom level 12 for portions of the AOI that are all ocean.
- The user should know how to transform the filenames into any caching strategy.
- The user must build an ESRI world file, as needed.
Updating Tile Cache
You can re-request that GetTile receive recent Map Tiles and overwrite the corresponding Map Tiles in the local disk by repeating steps 1-3 above.
World-File Generation
If needed by the application, you must generate your own world file for each tile. For more information about the contents of a world file, refer to http://en.wikipedia.org/wiki/World_file.
The X, Y, and Z values are used to translate from indexes to valid lat/lon values. The lat/lon values are used for lines 5 and 6 of the world-file.