Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
import streamlit as st
|
2 |
-
import
|
3 |
-
from
|
4 |
|
5 |
# Set the page configuration
|
6 |
st.set_page_config(page_title="Google Maps 3D", layout="wide")
|
@@ -8,22 +8,20 @@ st.set_page_config(page_title="Google Maps 3D", layout="wide")
|
|
8 |
# Set your Google Maps API key
|
9 |
api_key = os.get_env(["GM_TOKEN"])
|
10 |
|
11 |
-
#
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
"requestRenderMode": True,
|
16 |
-
}
|
17 |
|
18 |
-
#
|
19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
|
21 |
-
#
|
22 |
-
|
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)
|
|
|
1 |
import streamlit as st
|
2 |
+
import folium
|
3 |
+
from streamlit_folium import folium_static
|
4 |
|
5 |
# Set the page configuration
|
6 |
st.set_page_config(page_title="Google Maps 3D", layout="wide")
|
|
|
8 |
# Set your Google Maps API key
|
9 |
api_key = os.get_env(["GM_TOKEN"])
|
10 |
|
11 |
+
# Create a Folium map instance
|
12 |
+
map_center = [37.7749, -122.4194] # Example coordinates for San Francisco
|
13 |
+
map_zoom = 12
|
14 |
+
m = folium.Map(location=map_center, zoom_start=map_zoom)
|
|
|
|
|
15 |
|
16 |
+
# Add the Google Maps 3D tile layer
|
17 |
+
google_3d_layer = folium.TileLayer(
|
18 |
+
tiles=f"https://tile.googleapis.com/v1/3dtiles/root.json?key={api_key}",
|
19 |
+
attr="Google",
|
20 |
+
name="Google Maps 3D",
|
21 |
+
overlay=True,
|
22 |
+
control=True,
|
23 |
+
)
|
24 |
+
google_3d_layer.add_to(m)
|
25 |
|
26 |
+
# Display the Folium map using streamlit-folium
|
27 |
+
folium_static(m, width=800, height=600)
|
|
|
|
|
|
|
|
|
|
|
|
|
|