cartopy icon indicating copy to clipboard operation
cartopy copied to clipboard

tile cache not updated for different tile style

Open apatlpo opened this issue 2 years ago • 0 comments

Description

Cached tile data is not updated when a different style of the same tile source is used. It should be updated.

This could be achieved if the style was included in the cache dir name. In the example below, this could achieved if data were store in /tmp/cartopy_cache/Stamen_terrain and /tmp/cartopy_cache/Stamen_toner instead of /tmp/cartopy_cache/Stamen.

Code to reproduce

import matplotlib.pyplot as plt
import cartopy.io.img_tiles as cimgt

def plot(tile):
    fig = plt.figure()
    ax = fig.add_subplot(1, 1, 1, projection=tile.crs)
    ax.set_extent([-2, 2, 49, 50])
    ax.add_image(tile, 10)

stamen_terrain = cimgt.Stamen('terrain', cache="/tmp/cartopy_cache")
stamen_toner = cimgt.Stamen('toner', cache="/tmp/cartopy_cache")
google_tiles = cimgt.GoogleTiles(cache="/tmp/cartopy_cache")

plot(stamen_terrain)
plot(stamen_toner)
plot(google_tiles)

cartopy version: '0.21.1'

apatlpo avatar Jan 08 '23 13:01 apatlpo