Updating deck-gl viewport

Can I somehow update the viewport based on the selection? In the following example the map keeps pointing to New York no matter what I select:

import streamlit as st
import pandas as pd

all_cities = pd.DataFrame(
    [(40.7127837, -74.0059413),(34.0522342, -118.2436849),(41.8781136, -87.6297982)],
    ['New York', 'Los Angeles', 'Chicago'],
    ['lat','lon'])

selected_city = st.selectbox('Select city', all_cities.index)

st.deck_gl_chart(
    viewport={
        'latitude': all_cities.loc[selected_city, 'lat'],
        'longitude': all_cities.loc[selected_city, 'lon'],
        'zoom': 11,
    },
    layers=[{
        'type': 'ScatterplotLayer',
        'data': all_cities.loc[[selected_city]],
    }]
)
1 Like

Hi @neliseiska

That’s not supported right now, but should’t be hard to implement. I’ve created a bug for it here. Please upvote over there :smiley: