✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
⚡️ Concerned about the grid? Kyle Baranko teaches how to predicting peak loads using XGBoost. Register for the August webinar!

Error code 525 - Saving IMG - mapbox_style="open-street-map"

Hi everyone!

I’m trying to save a figure as follows:

import pandas as pd
us_cities = pd.read_csv("https://raw.githubusercontent.com/plotly/datasets/master/us-cities-top-1k.csv")

import plotly
import plotly.express as px

fig = px.scatter_mapbox(us_cities, lat="lat", lon="lon", hover_name="City", hover_data=["State", "Population"],
                        color_discrete_sequence=["fuchsia"], zoom=3, height=300)


However, I’ve got the following error:

ValueError: Transform failed with error code 525: Mapbox error.

It only occurs when I set the mapbox_style param as open-street-map. The other options work just fine.


1 Like

i have the same problem with px.choropleth_mapbox

Any answer?
I have the same problem.
Transform failed with error code 525: Mapbox error.

when i use open-street-map as mapbox style.

import plotly.graph_objects as go
import base64

def create_map_complience_img(geojsons, coordinates):
    fig = go.Figure(go.Scattermapbox(
    mode = "markers",
    lon = [coordinates[0]], lat = [coordinates[1]],
    marker = {'size': 20, 'color': ["cyan"]}))
    geojson = [ {'source': polygon, 'type':'fill'} for polygon in geojsons]
    mapbox = {
        'style': "open-street-map",
        'center': { 'lon': coordinates[0], 'lat': coordinates[1]},
        'zoom': 15, 'layers': geojson},
    margin = {'l':0, 'r':0, 'b':0, 't':0})
    fig.show() #show for test only and always ok, even when style is open-street-map
    img_bytes = fig.to_image(format="jpeg", width=950, height=246, scale=1, engine="kaleido") #here occurs the error
    img_src = "data:image/jpeg;base64,"+ base64.b64encode(img_bytes).decode('ascii')
    return img_src