Using geoviews tile sources offline?

Hi Holoviz discourse,

I would like to use the goeviews tile sources in an offline JupyterHub environment. Tiles access the underlying tile source with a URL. For the geoviews features like coastlines and states, I was able to download the cartopy features and configure cartopy to use the local files instead. Is there something similar for the geoviews tiles? Is it possible to use any tile sources offline?

Thank you!

Tile sources are just images, so you can copy the images from their source to any local mirror you like and use a URL pointing to that web server rather than the default one. That said, there are a lot of images in most tile sources, depending on how many levels deep they are., so copying them can be time consuming, expensive, and possibly disallowed by the tile source provider (who may cut you off part way through downloading the big stack of images). If you don’t need much resolution you can download the first few levels easily. E.g. the top level might be one 256x256 image, then 4 of them for the next, and so on, quickly becoming a very large number. Or you can pre-fetch only a small local area’s tiles, similarly. See Tiled web map - Wikipedia for details.