Spaces:
Sleeping
Sleeping
Fixed gee search dataset bug
Browse files- apps/gee.py +6 -9
apps/gee.py
CHANGED
@@ -63,8 +63,7 @@ def search_data():
|
|
63 |
|
64 |
dataset = None
|
65 |
with col2:
|
66 |
-
keyword = st.text_input(
|
67 |
-
"Enter a keyword to search (e.g., elevation)", "")
|
68 |
if keyword:
|
69 |
ee_assets = geemap.search_ee_data(keyword)
|
70 |
asset_titles = [x["title"] for x in ee_assets]
|
@@ -76,8 +75,7 @@ def search_data():
|
|
76 |
if dataset is not None:
|
77 |
with st.expander("Show dataset details", True):
|
78 |
index = asset_titles.index(dataset)
|
79 |
-
html = geemap.ee_data_html(
|
80 |
-
st.session_state["ee_assets"][index])
|
81 |
st.markdown(html, True)
|
82 |
|
83 |
ee_id = ee_assets[index]["ee_id_snippet"]
|
@@ -93,11 +91,11 @@ def search_data():
|
|
93 |
vis = {}
|
94 |
try:
|
95 |
if vis_params.strip() == "":
|
96 |
-
st.error("Please enter visualization parameters")
|
|
|
97 |
vis = eval(vis_params)
|
98 |
if not isinstance(vis, dict):
|
99 |
-
st.error(
|
100 |
-
"Visualization parameters must be a dictionary")
|
101 |
try:
|
102 |
Map.addLayer(eval(ee_id), vis, layer_name)
|
103 |
except Exception as e:
|
@@ -115,8 +113,7 @@ def search_data():
|
|
115 |
def app():
|
116 |
st.title("Google Earth Engine Applications")
|
117 |
|
118 |
-
apps = [
|
119 |
-
"National Land Cover Database (NLCD)", "Search Earth Engine Data Catalog"]
|
120 |
|
121 |
selected_app = st.selectbox("Select an app", apps)
|
122 |
|
|
|
63 |
|
64 |
dataset = None
|
65 |
with col2:
|
66 |
+
keyword = st.text_input("Enter a keyword to search (e.g., elevation)", "")
|
|
|
67 |
if keyword:
|
68 |
ee_assets = geemap.search_ee_data(keyword)
|
69 |
asset_titles = [x["title"] for x in ee_assets]
|
|
|
75 |
if dataset is not None:
|
76 |
with st.expander("Show dataset details", True):
|
77 |
index = asset_titles.index(dataset)
|
78 |
+
html = geemap.ee_data_html(st.session_state["ee_assets"][index])
|
|
|
79 |
st.markdown(html, True)
|
80 |
|
81 |
ee_id = ee_assets[index]["ee_id_snippet"]
|
|
|
91 |
vis = {}
|
92 |
try:
|
93 |
if vis_params.strip() == "":
|
94 |
+
# st.error("Please enter visualization parameters")
|
95 |
+
vis_params = "{}"
|
96 |
vis = eval(vis_params)
|
97 |
if not isinstance(vis, dict):
|
98 |
+
st.error("Visualization parameters must be a dictionary")
|
|
|
99 |
try:
|
100 |
Map.addLayer(eval(ee_id), vis, layer_name)
|
101 |
except Exception as e:
|
|
|
113 |
def app():
|
114 |
st.title("Google Earth Engine Applications")
|
115 |
|
116 |
+
apps = ["National Land Cover Database (NLCD)", "Search Earth Engine Data Catalog"]
|
|
|
117 |
|
118 |
selected_app = st.selectbox("Select an app", apps)
|
119 |
|