Notice – if you are thinking of using this technique, please be a good citizen and keep your tile scraping to a minimum. I’ve had our product team tell me that aggressive use of this script hammers our tile servers, so to avoid this please don’t siphon to a deep level over a wide area. Let’s all play nicely together and we’ll get along.
A couple of weeks ago I saw a request from a customer asking if it was possible to have more detail in the Tableau offline map tile cache – that is the set of tile images that is included as part of a Tableau install and used when you select Map menu -> Background Maps > Offline.
Off the back of this request I did a little experimentation to see if it was possible to make the offline tile cache larger. Turns out it is possible and not terribly difficult, but it is (of course) unsupported.
The offline tile cache (for 64-bit Tableau Desktop) is in C:\Program Files\Tableau\Tableau 8.1\Local\Maps with subdirectories for languages. Under US is the English version which is where I was working. Under the normal directory you will find a series of nested folders that reflect the zoom level, each containing the tiles. Out of the box, Tableau provides tiles to zoom level 5 globally.
I have created two Python scripts. The first “get_tiles_globally.py” pulls tiles for the entire globe to a nominated depth. Edit the file to select which tiles you want to use (grey or original) and the depth to which you want to generate. Note that this is an exponential problem and each level has 2^n tiles so by the time you get to level 7 (for example) you will have 32K tiles. This makes the tile cache much larger and takes quite some time to generate so please be thoughtful of our tile servers.
To save some time and bandwidth, I have already generated tiles down to level 7 globally (i.e. 2 further levels of drill) and you can pull them from here:
It also turns out that we can selectively extract parts of the globe to a deeper level and if we are just drilling in on a smaller region this is a good way to have zoom level 8+ tiles. See the second Python script “get_tiles_bounded.py” – edit this to select the tile format, the zoom levels as well as a bounding box expressed in lat/long. It will pull the tiles just in this area.
Of course, this is:
- Unsupported – if this breaks, you can’t call support (or me 🙂 ) so you better keep a backup of your original tile folder;
- Going to break between upgrades – you must remember to back the cache up and reapply;
- Very slow to populate globally below level 6 and even in defined regions below level 10;
- Totally freaking awesome as we could use this technique to get other tile formats, potentially from other tile providers – offline aerial photography tiles, anyone?
PS: In case you are wondering where the URLs came from, they were the result of using Fiddler2 to watchTableau Desktop make requests. It will be a trivial exercise to find the URLs for other tile types in case you need other languages, levels of detail or if you intend to pull from a completely different tile provider.