Spaces:
Sleeping
Sleeping
update app.py
Browse files
app.py
CHANGED
@@ -368,19 +368,24 @@ if st.session_state.results:
|
|
368 |
# Convert the results to a DataFrame for better visualization
|
369 |
result_df = pd.DataFrame(st.session_state.results)
|
370 |
|
371 |
-
#
|
372 |
-
|
373 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
374 |
|
375 |
# Generate the dynamic filename
|
376 |
filename = f"{main_selection}_{sub_selection}_{start_date.strftime('%Y/%m/%d')}_{end_date.strftime('%Y/%m/%d')}_{shape_type}.csv"
|
377 |
|
378 |
# Convert results to DataFrame for download
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
)
|
|
|
368 |
# Convert the results to a DataFrame for better visualization
|
369 |
result_df = pd.DataFrame(st.session_state.results)
|
370 |
|
371 |
+
# If the shape type is 'Point', include 'Latitude' and 'Longitude'
|
372 |
+
if shape_type.lower() == 'point':
|
373 |
+
# Show the results in a table format with Latitude and Longitude
|
374 |
+
st.write("Processed Results Table (Points):")
|
375 |
+
st.dataframe(result_df[['Location Name', 'Latitude', 'Longitude', 'Calculated Value']])
|
376 |
+
else:
|
377 |
+
# For polygons, we only show the Location Name and Calculated Value
|
378 |
+
st.write("Processed Results Table (Polygons):")
|
379 |
+
st.dataframe(result_df[['Location Name', 'Calculated Value']])
|
380 |
|
381 |
# Generate the dynamic filename
|
382 |
filename = f"{main_selection}_{sub_selection}_{start_date.strftime('%Y/%m/%d')}_{end_date.strftime('%Y/%m/%d')}_{shape_type}.csv"
|
383 |
|
384 |
# Convert results to DataFrame for download
|
385 |
+
st.download_button(
|
386 |
+
label="Download results as CSV",
|
387 |
+
data=result_df.to_csv(index=False).encode('utf-8'),
|
388 |
+
file_name=filename,
|
389 |
+
mime='text/csv'
|
390 |
+
)
|
391 |
+
|
|