Skip to content

Commit 28e07fe

Browse files
authoredNov 6, 2023
Update stamen maps (#5967)
1 parent 0ca2aac commit 28e07fe

File tree

4 files changed

+41
-20
lines changed

4 files changed

+41
-20
lines changed
 

‎examples/reference/elements/bokeh/Tiles.ipynb

+4-2
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,9 @@
6161
"> See [`hv.util.transform.lon_lat_to_easting_northing(longitude, latitude)`](https://holoviews.org/reference_manual/holoviews.element.html?highlight=lon_lat_to_easting_northing#holoviews.element.Tiles.lon_lat_to_easting_northing)\n",
6262
">\n",
6363
"\n",
64-
"Both HoloViews and GeoViews provides a number of tile sources by default, provided by CartoDB, Stamen, OpenStreetMap, and Esri. These can be imported from the ``holoviews.element.tiles`` module and are provided as callable functions which return a ``Tiles`` element:"
64+
"Both HoloViews and GeoViews provides a number of tile sources by default, provided by CartoDB, OpenStreetMap, and Esri. Stamen tile sources are also available but require a Stadia account when not running locally; see [stadiamaps.com](https://stadiamaps.com/).\n",
65+
"\n",
66+
"Tile sources can be imported from the ``holoviews.element.tiles`` module and are provided as callable functions which return a ``Tiles`` element:"
6567
]
6668
},
6769
{
@@ -77,7 +79,7 @@
7779
"cell_type": "markdown",
7880
"metadata": {},
7981
"source": [
80-
"The full set of predefined tile sources can be accessed on the ``holoviews.element.tiles.tile_sources`` dictionary."
82+
"The full set of predefined tile sources can be accessed on the ``holoviews.element.tiles.tile_sources`` and ``holoviews.element.tiles.stamen_sources`` dictionaries."
8183
]
8284
},
8385
{

‎examples/reference/elements/plotly/Tiles.ipynb

+21-3
Original file line numberDiff line numberDiff line change
@@ -51,16 +51,34 @@
5151
"cell_type": "markdown",
5252
"metadata": {},
5353
"source": [
54-
"One thing to note about tile sources is that they are always defined in the [pseudo-Mercator projection](https://epsg.io/3857), which means that if you want to overlay any data on top of a tile source the values have to be expressed as eastings and northings. If you have data in another projection, e.g. latitudes and longitudes, it may make sense to use [GeoViews](http://geoviews.org/) for it to handle the projections for you.\n",
54+
"One thing to note about tile sources is that they are always defined in the [pseudo-Mercator projection](https://epsg.io/3857), which means that if you want to overlay any data on top of a tile source the values have to be expressed as eastings and northings. If you have data in another projection, e.g. latitudes and longitudes, it may make sense to use [GeoViews](https://geoviews.org/) for it to handle the projections for you.\n",
5555
"\n",
56-
"Both HoloViews and GeoViews provides a number of tile sources by default, provided by CartoDB, Stamen, OpenStreetMap, and Esri. These can be imported from the ``holoviews.element.tiles`` module and are provided as callable functions that return a ``Tiles`` element:"
56+
">\n",
57+
"> **Note**: \n",
58+
"> \n",
59+
"> Holoviews provides functions to project longitude, latitude into Web Mercator coordinates. \n",
60+
"> See [`hv.util.transform.lon_lat_to_easting_northing(longitude, latitude)`](https://holoviews.org/reference_manual/holoviews.element.html?highlight=lon_lat_to_easting_northing#holoviews.element.Tiles.lon_lat_to_easting_northing)\n",
61+
">\n",
62+
"\n",
63+
"Both HoloViews and GeoViews provides a number of tile sources by default, provided by CartoDB, OpenStreetMap, and Esri. Stamen tile sources are also available but require a Stadia account when not running locally; see [stadiamaps.com](https://stadiamaps.com/).\n",
64+
"\n",
65+
"Tile sources can be imported from the ``holoviews.element.tiles`` module and are provided as callable functions which return a ``Tiles`` element:"
66+
]
67+
},
68+
{
69+
"cell_type": "code",
70+
"execution_count": null,
71+
"metadata": {},
72+
"outputs": [],
73+
"source": [
74+
"hv.element.tiles.EsriImagery().opts(width=600, height=550)"
5775
]
5876
},
5977
{
6078
"cell_type": "markdown",
6179
"metadata": {},
6280
"source": [
63-
"The full set of predefined tile sources can be accessed on the ``holoviews.element.tiles.tile_sources`` dictionary:"
81+
"The full set of predefined tile sources can be accessed on the ``holoviews.element.tiles.tile_sources`` and ``holoviews.element.tiles.stamen_sources`` dictionaries."
6482
]
6583
},
6684
{

‎holoviews/element/tiles.py

+15-14
Original file line numberDiff line numberDiff line change
@@ -85,14 +85,14 @@ def easting_northing_to_lon_lat(easting, northing):
8585
'&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, '
8686
'&copy; <a href="https://cartodb.com/attributions">CartoDB</a>'
8787
),
88-
('stamen', 'net/t') : ( # to match both 'toner' and 'terrain'
89-
'Map tiles by <a href="https://stamen.com">Stamen Design</a>, '
88+
('stamen', 'png') : ( # to match both 'toner' and 'terrain'
89+
'Map tiles by <a href="https://stamen.com">Stamen Design</a> / <a href="https://stadiamaps.com">Stadia Maps</a>, '
9090
'under <a href="https://creativecommons.org/licenses/by/3.0">CC BY 3.0</a>. '
9191
'Data by <a href="https://openstreetmap.org">OpenStreetMap</a>, '
9292
'under <a href="https://www.openstreetmap.org/copyright">ODbL</a>.'
9393
),
94-
('stamen', 'watercolor') : (
95-
'Map tiles by <a href="https://stamen.com">Stamen Design</a>, '
94+
('stamen', 'jpg') : ( # watercolor
95+
'Map tiles by <a href="https://stamen.com">Stamen Design</a> / <a href="https://stadiamaps.com">Stadia Maps</a>, '
9696
'under <a href="https://creativecommons.org/licenses/by/3.0">CC BY 3.0</a>. '
9797
'Data by <a href="https://openstreetmap.org">OpenStreetMap</a>, '
9898
'under <a href="https://creativecommons.org/licenses/by-sa/3.0">CC BY SA</a>.'
@@ -132,15 +132,15 @@ def easting_northing_to_lon_lat(easting, northing):
132132

133133

134134
# Stamen basemaps
135-
StamenTerrain = lambda: Tiles('https://stamen-tiles.a.ssl.fastly.net/terrain/{Z}/{X}/{Y}.png', name="StamenTerrain")
136-
StamenTerrainRetina = lambda: Tiles('https://stamen-tiles.a.ssl.fastly.net/terrain/{Z}/{X}/{Y}@2x.png', name="StamenTerrainRetina")
137-
StamenWatercolor = lambda: Tiles('https://stamen-tiles.a.ssl.fastly.net/watercolor/{Z}/{X}/{Y}.jpg', name="StamenWatercolor")
138-
StamenToner = lambda: Tiles('https://stamen-tiles.a.ssl.fastly.net/toner/{Z}/{X}/{Y}.png', name="StamenToner")
139-
StamenTonerRetina = lambda: Tiles('https://stamen-tiles.a.ssl.fastly.net/toner/{Z}/{X}/{Y}@2x.png', name="StamenTonerRetina")
140-
StamenTonerBackground = lambda: Tiles('https://stamen-tiles.a.ssl.fastly.net/toner-background/{Z}/{X}/{Y}.png', name="StamenTonerBackground")
141-
StamenTonerBackgroundRetina = lambda: Tiles('https://stamen-tiles.a.ssl.fastly.net/toner-background/{Z}/{X}/{Y}@2x.png', name="StamenTonerBackgroundRetina")
142-
StamenLabels = lambda: Tiles('https://stamen-tiles.a.ssl.fastly.net/toner-labels/{Z}/{X}/{Y}.png', name="StamenLabels")
143-
StamenLabelsRetina = lambda: Tiles('https://stamen-tiles.a.ssl.fastly.net/toner-labels/{Z}/{X}/{Y}@2x.png', name="StamenLabelsRetina")
135+
StamenTerrain = lambda: Tiles('https://tiles.stadiamaps.com/tiles/stamen_terrain/{Z}/{X}/{Y}.png', name="StamenTerrain")
136+
StamenTerrainRetina = lambda: Tiles('https://tiles.stadiamaps.com/tiles/stamen_terrain/{Z}/{X}/{Y}@2x.png', name="StamenTerrainRetina")
137+
StamenWatercolor = lambda: Tiles('https://tiles.stadiamaps.com/tiles/stamen_watercolor/{Z}/{X}/{Y}.jpg', name="StamenWatercolor")
138+
StamenToner = lambda: Tiles('https://tiles.stadiamaps.com/tiles/stamen_toner/{Z}/{X}/{Y}.png', name="StamenToner")
139+
StamenTonerRetina = lambda: Tiles('https://tiles.stadiamaps.com/tiles/stamen_toner/{Z}/{X}/{Y}@2x.png', name="StamenTonerRetina")
140+
StamenTonerBackground = lambda: Tiles('https://tiles.stadiamaps.com/tiles/stamen_toner_background/{Z}/{X}/{Y}.png', name="StamenTonerBackground")
141+
StamenTonerBackgroundRetina = lambda: Tiles('https://tiles.stadiamaps.com/tiles/stamen_toner_background/{Z}/{X}/{Y}@2x.png', name="StamenTonerBackgroundRetina")
142+
StamenLabels = lambda: Tiles('https://tiles.stadiamaps.com/tiles/stamen_toner_labels/{Z}/{X}/{Y}.png', name="StamenLabels")
143+
StamenLabelsRetina = lambda: Tiles('https://tiles.stadiamaps.com/tiles/stamen_toner_labels/{Z}/{X}/{Y}@2x.png', name="StamenLabelsRetina")
144144

145145
# Esri maps (see https://server.arcgisonline.com/arcgis/rest/services for the full list)
146146
EsriImagery = lambda: Tiles('https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{Z}/{Y}/{X}.jpg', name="EsriImagery")
@@ -160,4 +160,5 @@ def easting_northing_to_lon_lat(easting, northing):
160160
['ESRI', 'lon_lat_to_easting_northing', 'easting_northing_to_lon_lat',
161161
'deprecation_warning', 'wikimedia_replacement']}
162162

163-
tile_sources = {k: v for k, v in _all_tile_sources.items()}
163+
tile_sources = {k: v for k, v in _all_tile_sources.items() if "Stamen" not in k}
164+
stamen_sources = {k: v for k, v in _all_tile_sources.items() if "Stamen" in k}

‎holoviews/tests/plotting/plotly/test_tiles.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ def test_raster_layer(self):
102102
self.assertEqual(layer["sourcetype"], "raster")
103103
self.assertEqual(layer["minzoom"], 3)
104104
self.assertEqual(layer["maxzoom"], 7)
105-
self.assertEqual(layer["sourceattribution"], _ATTRIBUTIONS[('stamen', 'net/t')])
105+
self.assertEqual(layer["sourceattribution"], _ATTRIBUTIONS[('stamen', 'png')])
106106

107107
# xyzservices input
108108
def test_xyzservices_tileprovider(self):

0 commit comments

Comments
 (0)
Please sign in to comment.