Skip to content

Commit b0c45b3

Browse files
committed
Add migration guide
1 parent b7aff21 commit b0c45b3

File tree

1 file changed

+71
-0
lines changed

1 file changed

+71
-0
lines changed

doc/python/migrate-to-maplibre.md

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
---
2+
jupyter:
3+
jupytext:
4+
notebook_metadata_filter: all
5+
text_representation:
6+
extension: .md
7+
format_name: markdown
8+
format_version: '1.3'
9+
jupytext_version: 1.16.1
10+
kernelspec:
11+
display_name: Python 3 (ipykernel)
12+
language: python
13+
name: python3
14+
language_info:
15+
codemirror_mode:
16+
name: ipython
17+
version: 3
18+
file_extension: .py
19+
mimetype: text/x-python
20+
name: python
21+
nbconvert_exporter: python
22+
pygments_lexer: ipython3
23+
version: 3.10.11
24+
plotly:
25+
description: Migrating from Mapbox traces to MapLibre traces.
26+
display_as: basic
27+
language: python
28+
layout: base
29+
name: MapLibre Migration
30+
order: 1
31+
page_type: example_index
32+
permalink: python/mapbox-to-maplibre/
33+
redirect_from: python/mapbox-migration/
34+
thumbnail: thumbnail/line-and-scatter.jpg
35+
---
36+
37+
## Migrating from Mapbox traces to MapLibre traces
38+
39+
With the release of Plotly.py v5.24.0, we are introducing a new set of trace types for maps with tile underlays, including from Plotly Express:
40+
- `px.scatter_map`
41+
- `px.line_map`
42+
- `px.choropleth_map`
43+
- `px.density_map`
44+
45+
as well as Plotly Graph Objects:
46+
- `go.Choroplethmap`
47+
- `go.Scattermap`
48+
- `go.Densitymap`
49+
50+
These traces replace the existing Mapbox traces, `px.scatter_mapbox`, `px.line_mapbox`, etc., but use [MapLibre](https://maplibre.org) as the map renderer rather than Mapbox.
51+
52+
When switching to the new traces, keep an eye out for improved rendering performance, WebGL2 support, and over time, improved features in the Plotly map traces inherited from the MapLibre renderer, including projection support, globe views, terrain support, and support for modern mapping standards.
53+
54+
You can learn more about the motivations for this change in our [announcement post](https://plotly.com/blog/plotly-is-switching-to-maplibre/).
55+
56+
As a result of removing Mapbox as the rendering engine, we're also removing the Mapbox branding from these trace names. This means that migrating from Mapbox traces to MapLibre traces will require some code changes in your projects.
57+
58+
1. Change trace names from `*mapbox` to `*map`. For any existing trace name ending in `*mapbox`, ensure you've removed the "`box`" suffix.
59+
2. If in use, update `layout.mapbox` argument in your layout configuration to `layout.map`. The nested properties are identical in the new map traces, so no other changes should be required.
60+
3. If in use, update `mapbox_style` to `map_style`.
61+
4. Verify your `map_style` settings. With `mapbox` traces, we bundle `basic`, `streets`, `outdoors`, `light`, `dark`, `satellite`, and `satellite-streets` styles, using Mapbox styling. These style names are still available, but they now reference slightly different styles provided by other tools.
62+
63+
Note that Mapbox API keys are no longer required for Plotly-provided styles, but using external styles in your Plotly maps, remains supported with the existing API.
64+
65+
### Style changes
66+
Built-in styles in map traces are free styles from [Carto](https://carto.com) and [ESRI](https://www.esri.com/en-us/home). Several names are re-used from the previous Mapbox styles.
67+
<p align="center">
68+
<img src="https://raw.githubusercontent.com/plotly/plotly.js/master/test/image/baselines/map_predefined-styles1.png" alt="Style comparison part 1" width="45%" />
69+
<img src="https://raw.githubusercontent.com/plotly/plotly.js/master/test/image/baselines/map_predefined-styles2.png" alt="Style comparison part 2" width="45%" />
70+
</p>
71+

0 commit comments

Comments
 (0)