Pydeck_chart on Streamlit Questions

I tried to embed a map like the following URL in streamlit and publish it, but I couldn’t solve the problem, so I’d like to ask a question
I just started using streamlit, so please let me know if I’m saying something weird :grinning:

Reference Example_pydeck(terrain_layer)

My streamlit code

import pydeck as pdk
import streamlit as st

TERRAIN_IMAGE = "{z}/{x}/{y}.png"
SURFACE_IMAGE = f"{{z}}/{{x}}/{{y}}@2x.png? access_token={MAPBOX_API_KEY}"
ELEVATION_DECODER = {"rScaler": 256, "gScaler": 1, "bScaler": 1 / 256, "offset": -32768}
terrain_layer = pdk.Layer("TerrainLayer", elevation_decoder=ELEVATION_DECODER, 
texture=SURFACE_IMAGE, elevation_data=TERRAIN_IMAGE)
r = pdk.Deck(layers=terrain_layer)

1.The first map reloads the layers when you move it a bit.
I want it to work like the second map.

2.If I make it like the second map
I think it’s a bad implementation because it exposes the MAPBOX API KEY.(API KEY including html)

3.I want to prohibit the menu from appearing when right-clicking on the MAP.
For the second map, we could do something like this

r.to_html(as_string=True).replace("<body>","<body oncontextmenu='return false'>")

I think I can’t use this one because of the second thing.

My environment is Below


You can use streamlit secrets to hide your mapbox api key.

At the Time of executing ‘.to_html()’ function,
It’s seems be like API KEY is including .html files.

I’ve tried that(use secrets.toml) in my environment.
The result is the same.
.html including API KEY
It’s likes Below

 const jsonInput = {"initialViewState":...........{z}/{x}/{y}@2x.png?access_token=pk.xxxxxxxxxxxxxxxxxxx

So I wondered if I shouldn’t use embedding with to_html() for pydeck.