-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstreamlit_app.py
More file actions
49 lines (42 loc) · 1.72 KB
/
Copy pathstreamlit_app.py
File metadata and controls
49 lines (42 loc) · 1.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# Minimal Streamlit + Folium app for selecting a point on a map and calling core.get_location_properties
# Usage:
# 1) python -m venv venv; source venv/bin/activate
# 2) pip install -r requirements.txt
# 3) streamlit run streamlit_app.py
import streamlit as st
from streamlit_folium import st_folium
import folium
from core import get_location_properties
st.set_page_config(page_title="LocationWizard — OsdagBridge Starter", layout="wide")
st.title("LocationWizard — OsdagBridge (Starter)")
st.markdown(
"""
**Purpose:** click a point on the map (India) and the app will query **local** Survey-of-India shapefiles
to return seismic & basic wind information for that location.
**IMPORTANT:** The app expects SoI shapefiles placed under `data/`:
- data/soi_seismic_zones.shp (+ .shx, .dbf, ...)
- data/soi_wind_regions.shp (+ .shx, .dbf, ...)
"""
)
col1, col2 = st.columns([2, 1])
with col1:
# Center map on India
m = folium.Map(location=[22.0, 78.0], zoom_start=5, tiles="OpenStreetMap")
folium.LatLngPopup().add_to(m)
st.write("Click anywhere on the map. Selected coordinates will appear and be queried.")
map_data = st_folium(m, height=650)
with col2:
st.header("Selected location / results")
if map_data and map_data.get("last_clicked"):
lat = map_data["last_clicked"]["lat"]
lon = map_data["last_clicked"]["lng"]
st.write(f"**Coordinates:** {lat:.6f}, {lon:.6f}")
try:
props = get_location_properties(lat, lon)
st.json(props)
except FileNotFoundError as e:
st.error(str(e))
except Exception as e:
st.error(f"Lookup error: {e}")
else:
st.info("Click on the map to select a point.")