slv.basemap.cached_tiler#

slv.basemap.cached_tiler(tiles, **kwargs)[source]#

A cartopy tiler that caches its tiles on disk, safe to build in several processes at the same moment.

The tiler is tiles(cache=True, **kwargs). cartopy checks that the tiler’s cache folder is missing and then makes it with a plain mkdir. When another process makes the folder between the check and the mkdir (parallel tests, or jobs on one node that each draw their first map), the tiler raises FileExistsError. The folder exists by then, so a second attempt finds it and makes nothing.

Parameters:
  • tiles (type) – The tiler class, e.g. cartopy.io.img_tiles.GoogleTiles.

  • **kwargs – Passed to tiles, e.g. style="satellite".

Returns:

The tiler, an instance of tiles.

Return type:

cartopy.io.img_tiles.GoogleWTS

Examples

>>> from cartopy.io.img_tiles import GoogleTiles
>>> tiler = cached_tiler(GoogleTiles, style="satellite")