integrate with bhuvan
Browse files
app.py
CHANGED
@@ -52,17 +52,19 @@ formulas = {
|
|
52 |
"EVI": r"$G \times \frac{NIR - Red}{NIR + C1 \times Red - C2 \times Blue + L}$",
|
53 |
"EVI2": r"$G \times \frac{NIR - Red}{NIR + L + C \times Red}$",
|
54 |
}
|
|
|
55 |
veg_indices = []
|
56 |
-
for veg_index in all_veg_indices:
|
57 |
-
if st.checkbox(f"{veg_index} = {formulas[veg_index]}", value=
|
58 |
veg_indices.append(veg_index)
|
59 |
|
60 |
-
st.
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
|
|
66 |
|
67 |
############################################
|
68 |
# Functions
|
@@ -233,12 +235,15 @@ min_year = int(st.number_input("Minimum Year", value=2010, min_value=2010, step=
|
|
233 |
max_year = int(st.number_input("Maximum Year", value=max_year, min_value=2010, step=1))
|
234 |
|
235 |
# Input: GeoJSON/KML file
|
236 |
-
|
237 |
-
if
|
|
|
|
|
|
|
238 |
st.stop()
|
239 |
buffer = st.number_input("Buffer (m)", value=150, min_value=0, step=1)
|
240 |
|
241 |
-
input_gdf = preprocess_gdf(gpd.read_file(
|
242 |
|
243 |
# Input: Geometry
|
244 |
def format_fn(x):
|
|
|
52 |
"EVI": r"$G \times \frac{NIR - Red}{NIR + C1 \times Red - C2 \times Blue + L}$",
|
53 |
"EVI2": r"$G \times \frac{NIR - Red}{NIR + L + C \times Red}$",
|
54 |
}
|
55 |
+
defaults = [True, False, False]
|
56 |
veg_indices = []
|
57 |
+
for veg_index, default in zip(all_veg_indices, defaults):
|
58 |
+
if st.checkbox(f"{veg_index} = {formulas[veg_index]}", value=default):
|
59 |
veg_indices.append(veg_index)
|
60 |
|
61 |
+
with st.expander("EVI/EVI2 Parameters"):
|
62 |
+
st.write("Select the parameters for the EVI/EVI2 calculation (default is as per EVI's Wikipedia page)")
|
63 |
+
cols = st.columns(5)
|
64 |
+
evi_vars = {}
|
65 |
+
for col, name, default in zip(cols, ["G", "C1", "C2", "L", "C"], [2.5, 6, 7.5, 1, 2.4]):
|
66 |
+
value = col.number_input(f'{name}', value=default)
|
67 |
+
evi_vars[name] = value
|
68 |
|
69 |
############################################
|
70 |
# Functions
|
|
|
235 |
max_year = int(st.number_input("Maximum Year", value=max_year, min_value=2010, step=1))
|
236 |
|
237 |
# Input: GeoJSON/KML file
|
238 |
+
file_url = st.query_params.get("file_url", None)
|
239 |
+
if file_url is None:
|
240 |
+
file_url = st.file_uploader("Upload KML/GeoJSON file", type=["geojson", "kml", "shp"])
|
241 |
+
|
242 |
+
if file_url is None:
|
243 |
st.stop()
|
244 |
buffer = st.number_input("Buffer (m)", value=150, min_value=0, step=1)
|
245 |
|
246 |
+
input_gdf = preprocess_gdf(gpd.read_file(file_url))
|
247 |
|
248 |
# Input: Geometry
|
249 |
def format_fn(x):
|