Pydeck: Terrain model, how to avoid reloading when moving the camera

When displaying an elevation modele, the terrain disappear each time the camera moves.
On the online example here :TerrainLayer β€” pydeck 0.7.1 documentation, it works as expected, but when moved to streamlit, I get a non expected behaviour.

I am missing something ? is there a workaround ?

 MAPBOX_API_KEY = XXXXX
TERRAIN_IMAGE = "https://s3.amazonaws.com/elevation-tiles-prod/terrarium/{z}/{x}/{y}.png"
 ELEVATION_DECODER = {"rScaler": 256, "gScaler": 1, "bScaler": 1 / 256, "offset": -32768}
            SURFACE_IMAGE = f"https://api.mapbox.com/v4/mapbox.satellite/{{z}}/{{x}}/{{y}}@2x.png?access_token={MAPBOX_API_KEY}"
                    
terrain_layer = pdk.Layer(
                "TerrainLayer", elevation_decoder=ELEVATION_DECODER, texture=SURFACE_IMAGE, elevation_data=TERRAIN_IMAGE
            )

            view_state = pdk.ViewState(latitude=46.24, longitude=-122.18, zoom=11.5, bearing=140, pitch=60)

            st.pydeck_chart(pdk.Deck(terrain_layer, initial_view_state=view_state))

Cheers

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.