SciTools / cartopy

Cartopy - a cartographic python library with matplotlib support
https://scitools.org.uk/cartopy/docs/latest
BSD 3-Clause "New" or "Revised" License
1.38k stars 361 forks source link

Stamen watercolor tile requests send back HTTP Error 404 #2198

Closed wckoeppen closed 1 year ago

wckoeppen commented 1 year ago

Description

Attempting to use the cartopy.io.img_tiles.Stamen tiles with the watercolor style sends back an HTTP Error 404: Not Found error.

It looks like the Stamen tile urls may have changed slightly? This code asks for

f'http://tile.stamen.com/{self.style}/{z}/{x}/{y}.png'

These requests get redirected to https://tiles.stadiamaps.com/styles/, and it looks like the watercolor tiles are only made available there as jpg, not png. (Other tilesets are available in both formats.)

Doesn't work: https://tiles.stadiamaps.com/styles/stamen_watercolor/12/1104/1625.png Works: https://tiles.stadiamaps.com/styles/stamen_watercolor/12/1104/1625.jpg

Code to reproduce

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

request = cimgt.Stamen(style='watercolor')

fig = plt.figure()
ax = fig.add_axes([0,0,1,1], projection=request.crs)
ax.set_extent([-83.35, -83.30, 34.85, 34.90])
img = ax.add_image(request, 14)
plt.show()

Operating system

Mac OS Ventura 13.4.1

Cartopy version

0.21.1

conda list

  - numpy
  - gpxpy
  - python=3.10
  - shapely
  - geopandas
  - matplotlib
  - tqdm
  - cartopy
  - pandas
  - jupyterlab
lgolston commented 1 year ago

Thanks @wckoeppen for reporting! I don't know if the png version is still available or not, but jpg seems to be the primary version of watercolor so we should look at using that. More broadly, could be handled something like in openlayers: link

rcomer commented 1 year ago

I think this one is fixed by #2202?

dopplershift commented 1 year ago

I think so. This should be fixed either by running main or installing the next release when it becomes available. If you find that's not the case, feel free to re-open.

wckoeppen commented 12 months ago

Thanks everyone. Much appreciated!