Skip to content

Commit f7a9230

Browse files
authored
Tile source replacement warnings (#4941)
1 parent 36b32b4 commit f7a9230

4 files changed

Lines changed: 72 additions & 10 deletions

File tree

CHANGELOG.md

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
Version 1.14.4
22
==============
33

4-
This release primarily focuses on a number of bug fixes. Many thanks
5-
to @Hoxbro, @nitrocalcite, @brl0, @hyamanieu, @rafiyr, @jbednar and
6-
@philippjfr for contributing.
4+
This release primarily focuses on a number of bug fixes. Many thanks to
5+
@Hoxbro, @nitrocalcite, @brl0, @hyamanieu, @rafiyr, @jbednar, @jlstevens
6+
and @philippjfr for contributing.
77

88
Enhancements:
99

@@ -40,6 +40,20 @@ Documentation:
4040
- Updated docs to correctly declare Scatter kdims
4141
([#4914](https://github.com/holoviz/holoviews/pull/4914))
4242

43+
Compatibility:
44+
45+
Unfortunately a number of tile sources are no longer publicly
46+
available. Attempting to use these tile sources will now issue warnings
47+
unless `hv.config.raise_deprecated_tilesource_exception` is set to
48+
`True` in which case exceptions will be raised instead.
49+
50+
- The `Wikipedia` tile source is no longer available as it is no longer
51+
being served outside the wikimedia domain. As one of the most
52+
frequently used tile sources, HoloViews now issues a warning and
53+
switches to the OpenStreetMap (OSM) tile source instead.
54+
- The `CartoMidnight` and `CartoEco` tile sources are no longer publicly
55+
available. Attempting to use these tile sources will result in a
56+
deprecation warning.
4357

4458
Version 1.14.3
4559
==============

doc/releases.rst

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ Version 1.14
77
Version 1.14.4
88
**************
99

10-
This release primarily focuses on a number of bug fixes. Many thanks
11-
to @Hoxbro, @nitrocalcite, @brl0, @hyamanieu, @rafiyr, @jbednar and
12-
@philippjfr for contributing.
10+
This release primarily focuses on a number of bug fixes. Many thanks to
11+
@Hoxbro, @nitrocalcite, @brl0, @hyamanieu, @rafiyr, @jbednar, @jlstevens
12+
and @philippjfr for contributing.
1313

1414
Enhancements:
1515

@@ -46,6 +46,21 @@ Documentation:
4646
- Updated docs to correctly declare Scatter kdims
4747
(`#4914 <https://github.com/holoviz/holoviews/pull/4914>`_)
4848

49+
Compatibility:
50+
51+
Unfortunately a number of tile sources are no longer publicly available.
52+
Attempting to use these tile sources will now issue warnings unless
53+
``hv.config.raise_deprecated_tilesource_exception`` is set to ``True``
54+
in which case exceptions will be raised instead.
55+
56+
- The ``Wikipedia`` tile source is no longer available as it is no
57+
longer being served outside the wikimedia domain. As one of the most
58+
frequently used tile sources, HoloViews now issues a warning and
59+
switches to the OpenStreetMap (OSM) tile source instead.
60+
- The ``CartoMidnight`` and ``CartoEco`` tile sources are no longer
61+
publicly available. Attempting to use these tile sources will result
62+
in a deprecation warning.
63+
4964

5065
Version 1.14.3
5166
**************

holoviews/core/util.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,10 @@ class Config(param.ParameterizedFunction):
163163
Global default colormap for HeatMap elements. Prior to HoloViews
164164
1.14.0, the default value was the 'RdYlBu_r' colormap.""")
165165

166+
raise_deprecated_tilesource_exception = param.Boolean(default=False,
167+
doc=""" Whether deprecated tile sources should raise a
168+
deprecation exception instead of issuing warnings.""")
169+
166170
def __call__(self, **params):
167171
self.param.set_param(**params)
168172
return self

holoviews/element/tiles.py

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,11 +131,25 @@ def easting_northing_to_lon_lat(easting, northing):
131131
)
132132
}
133133

134+
def deprecation_warning(name, url, reason):
135+
def deprecated_tilesource_warning():
136+
if util.config.raise_deprecated_tilesource_exception:
137+
raise DeprecationWarning('%s tile source is deprecated: %s' % (name, reason))
138+
param.main.param.warning('%s tile source is deprecated and is likely to be unusable: %s' % (name, reason))
139+
return Tiles(url, name=name)
140+
return deprecated_tilesource_warning
141+
142+
134143
# CartoDB basemaps
135144
CartoDark = lambda: Tiles('https://cartodb-basemaps-4.global.ssl.fastly.net/dark_all/{Z}/{X}/{Y}.png', name="CartoDark")
136-
CartoEco = lambda: Tiles('https://3.api.cartocdn.com/base-eco/{Z}/{X}/{Y}.png', name="CartoEco")
137145
CartoLight = lambda: Tiles('https://cartodb-basemaps-4.global.ssl.fastly.net/light_all/{Z}/{X}/{Y}.png', name="CartoLight")
138-
CartoMidnight = lambda: Tiles('https://3.api.cartocdn.com/base-midnight/{Z}/{X}/{Y}.png', name="CartoMidnight")
146+
CartoMidnight = deprecation_warning('CartoMidnight',
147+
'https://3.api.cartocdn.com/base-midnight/{Z}/{X}/{Y}.png',
148+
'no longer publicly available.')
149+
CartoEco = deprecation_warning('CartoEco',
150+
'https://3.api.cartocdn.com/base-eco/{Z}/{X}/{Y}.png',
151+
'no longer publicly available.')
152+
139153

140154
# Stamen basemaps
141155
StamenTerrain = lambda: Tiles('https://stamen-tiles.a.ssl.fastly.net/terrain/{Z}/{X}/{Y}.png', name="StamenTerrain")
@@ -157,8 +171,23 @@ def easting_northing_to_lon_lat(easting, northing):
157171
EsriReference = lambda: Tiles('https://server.arcgisonline.com/ArcGIS/rest/services/Reference/World_Reference_Overlay/MapServer/tile/{Z}/{Y}/{X}', name="EsriReference")
158172
ESRI = EsriImagery # For backwards compatibility with gv 1.5
159173

174+
175+
def wikimedia_replacement():
176+
if util.config.raise_deprecated_tilesource_exception:
177+
raise DeprecationWarning('Wikipedia tile source no longer available outside '
178+
'wikimedia domain as of April 2021.')
179+
180+
param.main.param.warning('Wikipedia tile source no longer available outside '
181+
'wikimedia domain as of April 2021; switching '
182+
'to OpenStreetMap (OSM) tile source. '
183+
'See release notes for HoloViews'
184+
' 1.14.4 for more details')
185+
return Tiles('https://c.tile.openstreetmap.org/{Z}/{X}/{Y}.png', name="OSM")
186+
160187
# Miscellaneous
161188
OSM = lambda: Tiles('https://c.tile.openstreetmap.org/{Z}/{X}/{Y}.png', name="OSM")
162-
Wikipedia = lambda: Tiles('https://maps.wikimedia.org/osm-intl/{Z}/{X}/{Y}@2x.png', name="Wikipedia")
189+
Wikipedia = wikimedia_replacement
163190

164-
tile_sources = {k: v for k, v in locals().items() if isinstance(v, FunctionType) and k not in ['ESRI', 'lon_lat_to_easting_northing', 'easting_northing_to_lon_lat']}
191+
tile_sources = {k: v for k, v in locals().items() if isinstance(v, FunctionType) and k not in
192+
['ESRI', 'lon_lat_to_easting_northing', 'easting_northing_to_lon_lat',
193+
'deprecation_warning', 'wikimedia_replacement']}

0 commit comments

Comments
 (0)