Update pages/12_🌲_VertXtractor.py
Browse files- pages/12_🌲_VertXtractor.py +33 -27
pages/12_🌲_VertXtractor.py
CHANGED
@@ -364,10 +364,16 @@ with col3:
|
|
364 |
with col4:
|
365 |
ymax = st.number_input("Max Latitude", value=46.2500, step=0.0001, format="%.4f")
|
366 |
|
|
|
|
|
|
|
|
|
|
|
367 |
if st.button("Set Bounding Box"):
|
368 |
st.session_state.bbox = [xmin, ymin, xmax, ymax]
|
|
|
369 |
|
370 |
-
if
|
371 |
st.write(f"Selected bounding box (WGS84): {st.session_state.bbox}")
|
372 |
|
373 |
# Convert bbox to LV95
|
@@ -379,33 +385,33 @@ if 'bbox' in st.session_state:
|
|
379 |
|
380 |
if st.button("Get Download Links"):
|
381 |
with st.spinner("Fetching download links..."):
|
382 |
-
urls = get_urls(bbox_wgs84, mnt, mns, bati3D_v2, bati3D_v3, ortho, mnt_resol, ortho_resol)
|
383 |
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
|
410 |
# Option to download forest data
|
411 |
if st.button("Download Forest Data"):
|
|
|
364 |
with col4:
|
365 |
ymax = st.number_input("Max Latitude", value=46.2500, step=0.0001, format="%.4f")
|
366 |
|
367 |
+
if 'bbox' not in st.session_state:
|
368 |
+
st.session_state.bbox = None
|
369 |
+
if 'urls' not in st.session_state:
|
370 |
+
st.session_state.urls = None
|
371 |
+
|
372 |
if st.button("Set Bounding Box"):
|
373 |
st.session_state.bbox = [xmin, ymin, xmax, ymax]
|
374 |
+
st.session_state.urls = None # Reset urls when bbox changes
|
375 |
|
376 |
+
if st.session_state.bbox:
|
377 |
st.write(f"Selected bounding box (WGS84): {st.session_state.bbox}")
|
378 |
|
379 |
# Convert bbox to LV95
|
|
|
385 |
|
386 |
if st.button("Get Download Links"):
|
387 |
with st.spinner("Fetching download links..."):
|
388 |
+
st.session_state.urls = get_urls(bbox_wgs84, mnt, mns, bati3D_v2, bati3D_v3, ortho, mnt_resol, ortho_resol)
|
389 |
|
390 |
+
if st.session_state.urls:
|
391 |
+
st.success(f"Found {len(st.session_state.urls)} files to download:")
|
392 |
+
for url in st.session_state.urls:
|
393 |
+
st.write(url)
|
394 |
+
|
395 |
+
# Option to download individual files
|
396 |
+
if st.button("Download Individual Files"):
|
397 |
+
with st.spinner("Downloading files..."):
|
398 |
+
download_path = download_files(st.session_state.urls, "downloads")
|
399 |
+
st.success(f"Files downloaded to: {download_path}")
|
400 |
+
|
401 |
+
# Option to download and merge ortho images
|
402 |
+
ortho_urls = [url for url in st.session_state.urls if 'swissimage-dop10' in url]
|
403 |
+
if ortho_urls:
|
404 |
+
if st.button("Download and Merge Ortho Images"):
|
405 |
+
with st.spinner("Downloading and merging ortho images..."):
|
406 |
+
output_path = "merged_ortho.tif"
|
407 |
+
merged_path = download_and_merge_ortho(ortho_urls, output_path)
|
408 |
+
st.success(f"Merged ortho image saved to: {merged_path}")
|
409 |
+
|
410 |
+
# Display the merged image
|
411 |
+
image = Image.open(merged_path)
|
412 |
+
st.image(image, caption="Merged Ortho Image", use_column_width=True)
|
413 |
+
else:
|
414 |
+
st.warning("No files found for the selected area and options.")
|
415 |
|
416 |
# Option to download forest data
|
417 |
if st.button("Download Forest Data"):
|