Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
import os
|
3 |
+
from streamlit_cesium import st_cesium
|
4 |
+
|
5 |
+
# Set the page configuration
|
6 |
+
st.set_page_config(page_title="Google Maps 3D", layout="wide")
|
7 |
+
|
8 |
+
# Set your Google Maps API key
|
9 |
+
api_key = os.get_env(["GM_TOKEN"])
|
10 |
+
|
11 |
+
# Define the Cesium viewer options
|
12 |
+
cesium_options = {
|
13 |
+
"imageryProvider": False,
|
14 |
+
"baseLayerPicker": False,
|
15 |
+
"requestRenderMode": True,
|
16 |
+
}
|
17 |
+
|
18 |
+
# Create a Cesium viewer instance
|
19 |
+
viewer = st_cesium(cesium_options, height=600)
|
20 |
+
|
21 |
+
# Add the Photorealistic 3D Tiles tileset
|
22 |
+
tileset_url = f"https://tile.googleapis.com/v1/3dtiles/root.json?key={api_key}"
|
23 |
+
viewer.scene.primitives.add(viewer.Cesium.Cesium3DTileset(url=tileset_url, showCreditsOnScreen=True))
|
24 |
+
|
25 |
+
# Hide the default globe
|
26 |
+
viewer.scene.globe.show = False
|
27 |
+
|
28 |
+
# Display the Cesium viewer
|
29 |
+
st.components.v1.html(viewer.to_html(), height=600)
|