✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
🐇 Announcing Dash VTK for 3d simulation graphics. Check out the March webinar.

Update mapbox layout via callback

I have a mapbox in my dash layout. By default I define some defaults for map center, zoom level:


Within my dash layout, I then have some buttons that I’d like to trigger a callback to update the layout, rather than all the data in the figure as there is a lot of data and reloading it is costly.

I’ve tried a callback like this:

[Input(component_id='map_button_1', component_property='n_clicks'),
State('my_map', 'figure'),]
def recenter_map(click_in,fig):

But i get the error stating my_map needs to be of type dcc.Input.

Is there any way to achieve what I’m attempting?

Thanks in advance.

Input and State elements must be provided as two separate arguments (and both must be lists).

Thanks Emil, that solved my problem.