Skip to content

Commit 6b65f2e

Browse files
committed
Update mapbox-layers.md
1 parent df37b81 commit 6b65f2e

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

doc/python/mapbox-layers.md

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ jupyter:
66
extension: .md
77
format_name: markdown
88
format_version: '1.3'
9-
jupytext_version: 1.14.1
9+
jupytext_version: 1.14.6
1010
kernelspec:
1111
display_name: Python 3 (ipykernel)
1212
language: python
@@ -20,7 +20,7 @@ jupyter:
2020
name: python
2121
nbconvert_exporter: python
2222
pygments_lexer: ipython3
23-
version: 3.8.0
23+
version: 3.10.11
2424
plotly:
2525
description: How to make Mapbox maps in Python with various base layers, with
2626
or without needing a Mapbox Access token.
@@ -55,17 +55,21 @@ Mapbox tile maps are composed of various layers, of three different types:
5555

5656
#### Mapbox Access Tokens and When You Need Them
5757

58-
The word "mapbox" in the trace names and `layout.mapbox` refers to the Mapbox GL JS open-source library, which is integrated into Plotly.py. If your basemap in `layout.mapbox.style` uses data from the Mapbox _service_, then you will need to register for a free account at https://mapbox.com/ and obtain a Mapbox Access token. This token should be provided in `layout.mapbox.access_token` (or, if using Plotly Express, via the `px.set_mapbox_access_token()` configuration function).
58+
The word "mapbox" in the trace names and `layout.mapbox` refers to the Mapbox GL JS open-source library, which is integrated into Plotly.py.
59+
60+
If your basemap in `layout.mapbox.style` uses data from the Mapbox _service_, then you will need to register for a free account at https://mapbox.com/ and obtain a Mapbox Access token. This token should be provided in `layout.mapbox.access_token` (or, if using Plotly Express, via the `px.set_mapbox_access_token()` configuration function).
61+
62+
If you basemap in `layout.mapbox.style` uses maps from the [Stadia Maps service](https://www.stadiamaps.com) (see below for details), you'll need to register for a Stadia Maps account and token.
5963

60-
> If your `layout.mapbox.style` does not use data from the Mapbox service, you do _not_ need to register for a Mapbox account.
6164

6265
#### Base Maps in `layout.mapbox.style`
6366

6467
The accepted values for `layout.mapbox.style` are one of:
6568

6669
- `"white-bg"` yields an empty white canvas which results in no external HTTP requests
67-
- `"open-street-map"`, `"carto-positron"`, `"carto-darkmatter"`, `"stamen-terrain"`, `"stamen-toner"` or `"stamen-watercolor"` yield maps composed of _raster_ tiles from various public tile servers which do not require signups or access tokens
70+
- `"open-street-map"`, `"carto-positron"`, or `"carto-darkmatter"` yield maps composed of _raster_ tiles from various public tile servers which do not require signups or access tokens.
6871
- `"basic"`, `"streets"`, `"outdoors"`, `"light"`, `"dark"`, `"satellite"`, or `"satellite-streets"` yield maps composed of _vector_ tiles from the Mapbox service, and _do_ require a Mapbox Access Token or an on-premise Mapbox installation.
72+
- `"stamen-terrain"`, `"stamen-toner"` or `"stamen-watercolor"` yield maps composed of _raster_ tiles from the [Stadia Maps service](https://www.stadiamaps.com), and require a Stadia Maps account and token.
6973
- A Mapbox service style URL, which requires a Mapbox Access Token or an on-premise Mapbox installation.
7074
- A Mapbox Style object as defined at https://docs.mapbox.com/mapbox-gl-js/style-spec/
7175

@@ -88,7 +92,6 @@ fig.update_layout(margin={"r":0,"t":0,"l":0,"b":0})
8892
fig.show()
8993
```
9094

91-
<!-- #region -->
9295

9396
#### Using `layout.mapbox.layers` to Specify a Base Map
9497

@@ -100,7 +103,6 @@ If you have access to your own private tile servers, or wish to use a tile serve
100103

101104
Here is an example of a map which uses a public USGS imagery map, specified in `layout.mapbox.layers`, and which is rendered _below_ the `data` layer.
102105

103-
<!-- #endregion -->
104106

105107
```python
106108
import pandas as pd
@@ -126,13 +128,11 @@ fig.update_layout(margin={"r":0,"t":0,"l":0,"b":0})
126128
fig.show()
127129
```
128130

129-
<!-- #region -->
130131

131132
#### Base Tiles from the USGS, radar overlay from Environment Canada: no token needed
132133

133134
Here is the same example, with in addition, a WMS layer from Environment Canada which displays near-real-time radar imagery in partly-transparent raster tiles, rendered above the `go.Scattermapbox` trace, as is the default:
134135

135-
<!-- #endregion -->
136136

137137
```python
138138
import pandas as pd
@@ -165,13 +165,11 @@ fig.update_layout(margin={"r":0,"t":0,"l":0,"b":0})
165165
fig.show()
166166
```
167167

168-
<!-- #region -->
169168

170169
#### Dark tiles from Mapbox service: free token needed
171170

172171
Here is a map rendered with the `"dark"` style from the Mapbox service, which requires an Access Token:
173172

174-
<!-- #endregion -->
175173

176174
```python
177175
token = open(".mapbox_token").read() # you will need your own token

0 commit comments

Comments
 (0)