Display different regions on the map

Hi everyone, I have a problem, could you please help me?

I create a simple website, which has a selection box to select different regions (for example: California, and Washington). After users select a region, the map will automatically display that region. Below is my code, but it doesn’t meet my expectation, can you please help me in this case?

Thank you very much

import streamlit as st
import pydeck as pdk

region = st.selectbox("Select the region", ['California', 'Washington'], 1)
if region == 'California':
    lat = 37.356491094481505
    lng = -122.03289310426688
elif region == 'Washington':
    lat = 38.90651309591877
    lng = -77.03904851937264

view_state = pdk.ViewState(latitude=lat, longitude=lng,
                               zoom=11, pitch=45);
deck = pdk.Deck(map_style='mapbox://styles/mapbox/dark-v9',

Hi @doraemon123,

There is a bug with st.pydeck_chart that will be fixed when this PR is merged in.

I tried your code with the fix and it works great. You’ll be able to get the changes via the nightly build on the day it’s merged or you can wait until the next release, 0.61.0

1 Like

Thank you @Jonathan_Rhone, I hope this fix would be merged soon :grinning:

Just FYI @doraemon123 this is available on the latest version of Streamlit

1 Like