Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -5,8 +5,11 @@ import plotly.graph_objects as go
|
|
| 5 |
import plotly.express as px
|
| 6 |
import folium
|
| 7 |
from folium.plugins import MarkerCluster
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
-
# Streamlit-Folium kütüphanesini
|
| 10 |
try:
|
| 11 |
from streamlit_folium import st_folium
|
| 12 |
HAS_FOLIUM_EXT = True
|
|
@@ -15,25 +18,23 @@ except ImportError:
|
|
| 15 |
HAS_FOLIUM_EXT = False
|
| 16 |
|
| 17 |
# -----------------------------------------------------------------------------
|
| 18 |
-
# 1. SAYFA YAPILANDIRMASI &
|
| 19 |
# -----------------------------------------------------------------------------
|
| 20 |
st.set_page_config(
|
| 21 |
-
page_title="BoraPalyAI |
|
| 22 |
page_icon="🌍",
|
| 23 |
layout="wide",
|
| 24 |
initial_sidebar_state="expanded"
|
| 25 |
)
|
| 26 |
|
| 27 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
st.markdown("""
|
| 29 |
<style>
|
| 30 |
-
.metric-card {
|
| 31 |
-
background-color: #1E222D;
|
| 32 |
-
border-radius: 10px;
|
| 33 |
-
padding: 15px;
|
| 34 |
-
border-left: 5px solid #00D1B2;
|
| 35 |
-
margin-bottom: 10px;
|
| 36 |
-
}
|
| 37 |
.tijba-card {
|
| 38 |
background-color: #181B22;
|
| 39 |
border: 1px solid #2D313E;
|
|
@@ -52,63 +53,102 @@ st.markdown("""
|
|
| 52 |
""", unsafe_allow_html=True)
|
| 53 |
|
| 54 |
# -----------------------------------------------------------------------------
|
| 55 |
-
# 2. SİDEBAR &
|
| 56 |
# -----------------------------------------------------------------------------
|
| 57 |
st.sidebar.title("🌍 BoraPalyAI Geo-Portal")
|
| 58 |
-
st.sidebar.markdown("**
|
| 59 |
|
| 60 |
-
st.sidebar.
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
ada = st.sidebar.number_input("Ada", value=102, step=1)
|
| 64 |
-
parsel = st.sidebar.number_input("Parsel", value=14, step=1)
|
| 65 |
|
| 66 |
-
|
| 67 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 68 |
|
| 69 |
st.sidebar.divider()
|
| 70 |
-
st.sidebar.subheader("
|
| 71 |
-
|
| 72 |
-
|
| 73 |
z_exaggeration = st.sidebar.slider("3D Yükseklik Abartısı (Z-Factor)", 1.0, 5.0, 2.5, 0.5)
|
| 74 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 75 |
# -----------------------------------------------------------------------------
|
| 76 |
-
# 3.
|
| 77 |
# -----------------------------------------------------------------------------
|
| 78 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 79 |
|
| 80 |
col1, col2, col3, col4, col5 = st.columns(5)
|
| 81 |
-
col1.metric("📐 Parsel Alanı", "
|
| 82 |
-
col2.metric("⛰️
|
| 83 |
-
col3.metric("📐 Ort. Eğim", "%
|
| 84 |
-
col4.metric("💧
|
| 85 |
-
col5.metric("🧱 Ana Kaya
|
| 86 |
|
| 87 |
st.divider()
|
| 88 |
|
| 89 |
# -----------------------------------------------------------------------------
|
| 90 |
-
# 4. TAB YAPISI
|
| 91 |
# -----------------------------------------------------------------------------
|
| 92 |
tab1, tab2, tab3, tab4 = st.tabs([
|
| 93 |
-
"🗺️
|
| 94 |
-
"🏔️ 3D Arazi (DEM)
|
| 95 |
"🧱 Jeolojik Kolon Kesiti",
|
| 96 |
"🌐 TIJBA Jeoloji Sosyal Ağı"
|
| 97 |
])
|
| 98 |
|
| 99 |
-
# --- TAB 1:
|
| 100 |
with tab1:
|
| 101 |
-
st.subheader("
|
| 102 |
-
|
|
|
|
| 103 |
m = folium.Map(location=[lat, lon], zoom_start=16, tiles="OpenStreetMap")
|
| 104 |
|
| 105 |
-
# Parsel Poligonu
|
|
|
|
| 106 |
parsel_coords = [
|
| 107 |
-
[lat +
|
| 108 |
-
[lat +
|
| 109 |
-
[lat - 0.
|
| 110 |
-
[lat -
|
| 111 |
]
|
|
|
|
| 112 |
folium.Polygon(
|
| 113 |
locations=parsel_coords,
|
| 114 |
color="red",
|
|
@@ -116,63 +156,76 @@ with tab1:
|
|
| 116 |
fill=True,
|
| 117 |
fill_color="crimson",
|
| 118 |
fill_opacity=0.35,
|
| 119 |
-
tooltip="Parsel Sınırı (
|
| 120 |
).add_to(m)
|
| 121 |
|
| 122 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 123 |
if show_wells:
|
| 124 |
well_cluster = MarkerCluster(name="Su Kuyuları").add_to(m)
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
[lat + 0.0005, lon + 0.0020, "Kuyu #3 (Ruhsatlı DSİ Kuyusu)"]
|
| 129 |
-
]
|
| 130 |
-
for w_lat, w_lon, info in wells:
|
| 131 |
folium.Marker(
|
| 132 |
location=[w_lat, w_lon],
|
| 133 |
-
popup=
|
| 134 |
icon=folium.Icon(color="blue", icon="tint", prefix="fa")
|
| 135 |
).add_to(well_cluster)
|
| 136 |
|
| 137 |
-
# MTA
|
| 138 |
if show_geology:
|
| 139 |
folium.Rectangle(
|
| 140 |
bounds=[[lat - 0.003, lon - 0.003], [lat + 0.003, lon + 0.003]],
|
| 141 |
-
color="orange",
|
| 142 |
-
|
| 143 |
-
fill=True,
|
| 144 |
-
fill_color="khaki",
|
| 145 |
-
fill_opacity=0.2,
|
| 146 |
-
tooltip="MTA Formasyon: Neojen Kireçtaşı - Alüvyon Geçişi"
|
| 147 |
).add_to(m)
|
| 148 |
|
| 149 |
-
# Harita
|
| 150 |
if HAS_FOLIUM_EXT:
|
| 151 |
-
st_folium(m, width="100%", height=550)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 152 |
else:
|
| 153 |
components.html(m._repr_html_(), height=550)
|
| 154 |
|
| 155 |
# --- TAB 2: 3D ARAZİ MODELİ (DEM EXAGGERATED) ---
|
| 156 |
with tab2:
|
| 157 |
-
st.subheader("3D
|
| 158 |
|
| 159 |
col_dem1, col_dem2 = st.columns([3, 1])
|
| 160 |
|
| 161 |
with col_dem1:
|
| 162 |
-
|
| 163 |
-
grid_size = 30
|
| 164 |
x = np.linspace(-2, 2, grid_size)
|
| 165 |
y = np.linspace(-2, 2, grid_size)
|
| 166 |
X, Y = np.meshgrid(x, y)
|
| 167 |
-
|
|
|
|
|
|
|
| 168 |
|
| 169 |
fig_3d = go.Figure(data=[go.Surface(z=Z, colorscale='Earth', showscale=True)])
|
| 170 |
fig_3d.update_layout(
|
| 171 |
-
title=f"3D Yükseklik
|
| 172 |
autosize=True,
|
| 173 |
scene=dict(
|
| 174 |
-
xaxis_title='
|
| 175 |
-
yaxis_title='
|
| 176 |
zaxis_title='Rakım (m)',
|
| 177 |
aspectratio=dict(x=1, y=1, z=0.5)
|
| 178 |
),
|
|
@@ -182,25 +235,26 @@ with tab2:
|
|
| 182 |
st.plotly_chart(fig_3d, use_container_width=True)
|
| 183 |
|
| 184 |
with col_dem2:
|
| 185 |
-
st.markdown("### 🏔️ Topoğrafik
|
| 186 |
-
st.info("**
|
| 187 |
-
|
|
|
|
|
|
|
| 188 |
|
| 189 |
-
|
|
|
|
|
|
|
| 190 |
with tab3:
|
| 191 |
-
st.subheader("Tahmini Stratigrafik Kolon Kesiti
|
| 192 |
-
st.caption("Çevre sondaj verileri ve MTA jeoloji haritalarından uzamsal interpolasyon (Kriging) ile üretilmiştir.")
|
| 193 |
|
| 194 |
col_geo1, col_geo2 = st.columns([2, 1])
|
| 195 |
|
| 196 |
with col_geo1:
|
| 197 |
-
# Stratigrafik Katman Tablosu Görselleştirme
|
| 198 |
layers_df = pd.DataFrame({
|
| 199 |
-
"Katman": ["Bitkisel Toprak
|
| 200 |
-
"
|
| 201 |
-
"
|
| 202 |
-
"
|
| 203 |
-
"Renk": ["#8B5A2B", "#CD853F", "#D2B48C", "#808080"]
|
| 204 |
})
|
| 205 |
|
| 206 |
fig_strat = px.bar(
|
|
@@ -211,55 +265,52 @@ with tab3:
|
|
| 211 |
color="Katman",
|
| 212 |
text="SPT (N60)",
|
| 213 |
color_discrete_sequence=layers_df["Renk"].tolist(),
|
| 214 |
-
title="
|
| 215 |
)
|
| 216 |
fig_strat.update_layout(height=400, showlegend=False)
|
| 217 |
st.plotly_chart(fig_strat, use_container_width=True)
|
| 218 |
|
| 219 |
with col_geo2:
|
| 220 |
-
st.markdown("### 💧 Yeraltı Suyu
|
| 221 |
-
st.markdown("""
|
| 222 |
-
* **Statik Su
|
| 223 |
-
* **Dinamik Su Seviyesi:**
|
| 224 |
-
* **
|
| 225 |
-
* **
|
| 226 |
""")
|
| 227 |
|
| 228 |
-
# --- TAB 4: TIJBA JEOLOJİ SOSYAL AĞI
|
| 229 |
with tab4:
|
| 230 |
-
st.subheader("🌐 TIJBA -
|
| 231 |
-
st.caption("Bu parsel ve çevresi hakkında jeoloji mühendislerinin ve arsa sahiplerinin paylaşımları.")
|
| 232 |
|
| 233 |
col_tij1, col_tij2 = st.columns([2, 1])
|
| 234 |
|
| 235 |
with col_tij1:
|
| 236 |
-
|
| 237 |
-
|
| 238 |
-
|
| 239 |
-
|
| 240 |
-
|
| 241 |
-
st.success("✅ Gözleminiz coğrafi etiketle (Geo-Tag) veritabanına işlendi ve akışa eklendi!")
|
| 242 |
|
| 243 |
st.divider()
|
| 244 |
-
st.markdown("### 📰
|
| 245 |
|
| 246 |
-
# Simüle Gönderiler
|
| 247 |
posts = [
|
| 248 |
{
|
| 249 |
-
"user": "Jeo. Müh.
|
| 250 |
"role": "Saha Mühendisi",
|
| 251 |
-
"time": "
|
| 252 |
-
"dist": "
|
| 253 |
-
"content": "
|
| 254 |
-
"likes":
|
| 255 |
},
|
| 256 |
{
|
| 257 |
-
"user": "Dr.
|
| 258 |
-
"role": "
|
| 259 |
"time": "1 gün önce",
|
| 260 |
-
"dist": "
|
| 261 |
-
"content": "
|
| 262 |
-
"likes":
|
| 263 |
}
|
| 264 |
]
|
| 265 |
|
|
@@ -269,21 +320,20 @@ with tab4:
|
|
| 269 |
<span class="badge-geo">{p['role']}</span> <b>{p['user']}</b>
|
| 270 |
<span style="color:gray; font-size:0.8em;">• {p['time']} ({p['dist']})</span>
|
| 271 |
<p style="margin-top:8px;">{p['content']}</p>
|
| 272 |
-
<small>❤️ {p['likes']} Mühendis
|
| 273 |
</div>
|
| 274 |
""", unsafe_allow_html=True)
|
| 275 |
|
| 276 |
with col_tij2:
|
| 277 |
-
st.markdown("### 🏆 Katkıda Bulunanlar")
|
| 278 |
st.markdown("""
|
| 279 |
-
1. 🥇 **Jeo. Müh.
|
| 280 |
-
2. 🥈 **Dr.
|
| 281 |
-
3. 🥉 **
|
| 282 |
""")
|
| 283 |
-
st.info("💡 TIJBA sosyal ağında paylaşılan her doğruluk onaylı zemin etüdü, yapay zeka modelimizin 3D kesit tahmin başarısını artırır.")
|
| 284 |
|
| 285 |
# -----------------------------------------------------------------------------
|
| 286 |
-
#
|
| 287 |
# -----------------------------------------------------------------------------
|
| 288 |
st.divider()
|
| 289 |
-
st.caption("© 2026 BoraPalyAI & TIJBA GeoTech Platformu |
|
|
|
|
| 5 |
import plotly.express as px
|
| 6 |
import folium
|
| 7 |
from folium.plugins import MarkerCluster
|
| 8 |
+
import json
|
| 9 |
+
import urllib.request
|
| 10 |
+
import urllib.parse
|
| 11 |
|
| 12 |
+
# Streamlit-Folium kütüphanesini kontrol etme
|
| 13 |
try:
|
| 14 |
from streamlit_folium import st_folium
|
| 15 |
HAS_FOLIUM_EXT = True
|
|
|
|
| 18 |
HAS_FOLIUM_EXT = False
|
| 19 |
|
| 20 |
# -----------------------------------------------------------------------------
|
| 21 |
+
# 1. SAYFA YAPILANDIRMASI & SESSION STATE (KONUM HAFIZASI)
|
| 22 |
# -----------------------------------------------------------------------------
|
| 23 |
st.set_page_config(
|
| 24 |
+
page_title="BoraPalyAI | Tüm Türkiye Geo-Portal",
|
| 25 |
page_icon="🌍",
|
| 26 |
layout="wide",
|
| 27 |
initial_sidebar_state="expanded"
|
| 28 |
)
|
| 29 |
|
| 30 |
+
# Varsayılan Konum (Session State)
|
| 31 |
+
if "lat" not in st.session_state:
|
| 32 |
+
st.session_state["lat"] = 38.3225
|
| 33 |
+
st.session_state["lon"] = 26.7682
|
| 34 |
+
st.session_state["location_name"] = "İzmir, Urla"
|
| 35 |
+
|
| 36 |
st.markdown("""
|
| 37 |
<style>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
.tijba-card {
|
| 39 |
background-color: #181B22;
|
| 40 |
border: 1px solid #2D313E;
|
|
|
|
| 53 |
""", unsafe_allow_html=True)
|
| 54 |
|
| 55 |
# -----------------------------------------------------------------------------
|
| 56 |
+
# 2. SİDEBAR & TÜRKİYE GENELİ LOKASYON ARAMA
|
| 57 |
# -----------------------------------------------------------------------------
|
| 58 |
st.sidebar.title("🌍 BoraPalyAI Geo-Portal")
|
| 59 |
+
st.sidebar.markdown("**Tüm Türkiye İnteraktif Parsel & Jeoloji Analizi**")
|
| 60 |
|
| 61 |
+
st.sidebar.divider()
|
| 62 |
+
st.sidebar.subheader("🔍 Türkiye Geneli Konum Ara")
|
| 63 |
+
search_query = st.sidebar.text_input("İl, İlçe, Mahalle veya Adres:", placeholder="Örn: Bodrum, Çankaya Ankara, Kadıköy")
|
|
|
|
|
|
|
| 64 |
|
| 65 |
+
if st.sidebar.button("🔎 Haritada Bul"):
|
| 66 |
+
if search_query:
|
| 67 |
+
try:
|
| 68 |
+
# OpenStreetMap Nominatim Servisi ile Ücretsiz Geocoding
|
| 69 |
+
encoded_query = urllib.parse.quote(f"{search_query}, Turkey")
|
| 70 |
+
url = f"https://nominatim.openstreetmap.org/search?format=json&q={encoded_query}"
|
| 71 |
+
req = urllib.request.Request(url, headers={'User-Agent': 'BoraPalyAI-App'})
|
| 72 |
+
|
| 73 |
+
with urllib.request.urlopen(req) as response:
|
| 74 |
+
data = json.loads(response.read().decode())
|
| 75 |
+
if data:
|
| 76 |
+
st.session_state["lat"] = float(data[0]["lat"])
|
| 77 |
+
st.session_state["lon"] = float(data[0]["lon"])
|
| 78 |
+
st.session_state["location_name"] = data[0]["display_name"].split(',')[0]
|
| 79 |
+
st.rerun()
|
| 80 |
+
else:
|
| 81 |
+
st.sidebar.error("Lokasyon bulunamadı! Lütfen arama metnini kontrol edin.")
|
| 82 |
+
except Exception as e:
|
| 83 |
+
st.sidebar.error(f"Arama gerçekleştirilemedi: {e}")
|
| 84 |
|
| 85 |
st.sidebar.divider()
|
| 86 |
+
st.sidebar.subheader("📍 Manuel Koordinat / Parsel Bilgisi")
|
| 87 |
+
ada = st.sidebar.number_input("Ada No", value=102, step=1)
|
| 88 |
+
parsel = st.sidebar.number_input("Parsel No", value=14, step=1)
|
| 89 |
z_exaggeration = st.sidebar.slider("3D Yükseklik Abartısı (Z-Factor)", 1.0, 5.0, 2.5, 0.5)
|
| 90 |
|
| 91 |
+
show_wells = st.sidebar.checkbox("Yeraltı Su Kuyuları Katmanı", value=True)
|
| 92 |
+
show_geology = st.sidebar.checkbox("MTA Jeoloji Katmanı", value=True)
|
| 93 |
+
|
| 94 |
+
# Aktif Koordinatlar
|
| 95 |
+
lat = st.session_state["lat"]
|
| 96 |
+
lon = st.session_state["lon"]
|
| 97 |
+
|
| 98 |
# -----------------------------------------------------------------------------
|
| 99 |
+
# 3. DİNAMİK METRİKLER (KOORDİNATA GÖRE RASTGELE/DİNAMİK HESAPLAMA)
|
| 100 |
# -----------------------------------------------------------------------------
|
| 101 |
+
# Seçilen koordinata özel deterministik rastgele sayı tohumu (seed)
|
| 102 |
+
seed = int((abs(lat) + abs(lon)) * 1000) % 100000
|
| 103 |
+
np.random.seed(seed)
|
| 104 |
+
|
| 105 |
+
area_m2 = int(np.random.uniform(1500, 12000))
|
| 106 |
+
avg_elevation = int(np.random.uniform(10, 850))
|
| 107 |
+
slope_pct = round(np.random.uniform(2.0, 22.0), 1)
|
| 108 |
+
water_table_min = int(np.random.uniform(8, 35))
|
| 109 |
+
water_table_max = water_table_min + int(np.random.uniform(5, 15))
|
| 110 |
+
|
| 111 |
+
rock_types = ["Kireçtaşı (Kalker)", "Alüvyon / Kil", "Andezit / Bazalt", "Marn / Kumtaşı", "Şist / Metamorfik"]
|
| 112 |
+
selected_rock = rock_types[seed % len(rock_types)]
|
| 113 |
+
|
| 114 |
+
st.title(f"📍 Parsel Analiz Raporu: {st.session_state['location_name']}")
|
| 115 |
+
st.caption(f"Seçili Konum Koordinatları: **Enlem:** {lat:.5f} | **Boylam:** {lon:.5f} | **Ada:** {ada} / **Parsel:** {parsel}")
|
| 116 |
|
| 117 |
col1, col2, col3, col4, col5 = st.columns(5)
|
| 118 |
+
col1.metric("📐 Parsel Alanı", f"{area_m2:,} m²")
|
| 119 |
+
col2.metric("⛰️ Ort. Rakım", f"{avg_elevation} m")
|
| 120 |
+
col3.metric("📐 Ort. Eğim", f"% {slope_pct}")
|
| 121 |
+
col4.metric("💧 Su Kotu", f"{water_table_min} - {water_table_max} m")
|
| 122 |
+
col5.metric("🧱 Ana Kaya", selected_rock)
|
| 123 |
|
| 124 |
st.divider()
|
| 125 |
|
| 126 |
# -----------------------------------------------------------------------------
|
| 127 |
+
# 4. TAB YAPISI
|
| 128 |
# -----------------------------------------------------------------------------
|
| 129 |
tab1, tab2, tab3, tab4 = st.tabs([
|
| 130 |
+
"🗺️ Interactive Harita (Tıkla & Seç)",
|
| 131 |
+
"🏔️ 3D Arazi (DEM) Modeli",
|
| 132 |
"🧱 Jeolojik Kolon Kesiti",
|
| 133 |
"🌐 TIJBA Jeoloji Sosyal Ağı"
|
| 134 |
])
|
| 135 |
|
| 136 |
+
# --- TAB 1: INTERAKTİF HARİTA (HARİTADAN TIKLAYIP PARSEL SEÇME) ---
|
| 137 |
with tab1:
|
| 138 |
+
st.subheader("💡 Haritaya Tıklayarak Türkiye'nin İstediğiniz Yerinden Parsel Seçebilirsiniz!")
|
| 139 |
+
st.info("👇 Haritada istediğiniz bir noktaya tıkladığınızda sistem o konumun 3D arazisini ve jeolojik verilerini anında günceller.")
|
| 140 |
+
|
| 141 |
m = folium.Map(location=[lat, lon], zoom_start=16, tiles="OpenStreetMap")
|
| 142 |
|
| 143 |
+
# Seçilen Noktaya Dinamik Parsel Poligonu Oluşturma
|
| 144 |
+
offset = 0.0008
|
| 145 |
parsel_coords = [
|
| 146 |
+
[lat + offset, lon - offset],
|
| 147 |
+
[lat + offset * 1.2, lon + offset * 0.9],
|
| 148 |
+
[lat - offset * 0.8, lon + offset * 1.1],
|
| 149 |
+
[lat - offset, lon - offset * 0.7]
|
| 150 |
]
|
| 151 |
+
|
| 152 |
folium.Polygon(
|
| 153 |
locations=parsel_coords,
|
| 154 |
color="red",
|
|
|
|
| 156 |
fill=True,
|
| 157 |
fill_color="crimson",
|
| 158 |
fill_opacity=0.35,
|
| 159 |
+
tooltip=f"Seçili Parsel Sınırı ({area_m2:,} m²)"
|
| 160 |
).add_to(m)
|
| 161 |
|
| 162 |
+
# Seçili Nokta İbreleri
|
| 163 |
+
folium.Marker(
|
| 164 |
+
location=[lat, lon],
|
| 165 |
+
popup=f"Seçilen Konum: {lat:.4f}, {lon:.4f}",
|
| 166 |
+
icon=folium.Icon(color="red", icon="info-sign")
|
| 167 |
+
).add_to(m)
|
| 168 |
+
|
| 169 |
+
# Su Kuyuları Katmanı (Dinamik Etrafa Serpiştirilmiş)
|
| 170 |
if show_wells:
|
| 171 |
well_cluster = MarkerCluster(name="Su Kuyuları").add_to(m)
|
| 172 |
+
for i in range(3):
|
| 173 |
+
w_lat = lat + np.random.uniform(-0.002, 0.002)
|
| 174 |
+
w_lon = lon + np.random.uniform(-0.002, 0.002)
|
|
|
|
|
|
|
|
|
|
| 175 |
folium.Marker(
|
| 176 |
location=[w_lat, w_lon],
|
| 177 |
+
popup=f"Kuyu #{i+1} (Derinlik: {np.random.randint(30,90)}m)",
|
| 178 |
icon=folium.Icon(color="blue", icon="tint", prefix="fa")
|
| 179 |
).add_to(well_cluster)
|
| 180 |
|
| 181 |
+
# MTA Formasyon Katmanı
|
| 182 |
if show_geology:
|
| 183 |
folium.Rectangle(
|
| 184 |
bounds=[[lat - 0.003, lon - 0.003], [lat + 0.003, lon + 0.003]],
|
| 185 |
+
color="orange", weight=1, fill=True, fill_color="khaki", fill_opacity=0.2,
|
| 186 |
+
tooltip=f"MTA Saha Formasyonu: {selected_rock}"
|
|
|
|
|
|
|
|
|
|
|
|
|
| 187 |
).add_to(m)
|
| 188 |
|
| 189 |
+
# Harita Etkileşimi ve Tıklama Yakalama
|
| 190 |
if HAS_FOLIUM_EXT:
|
| 191 |
+
map_data = st_folium(m, width="100%", height=550, key="main_map")
|
| 192 |
+
|
| 193 |
+
# Kullanıcı haritada yeni bir yere tıkladıysa
|
| 194 |
+
if map_data and map_data.get("last_clicked"):
|
| 195 |
+
clicked_lat = map_data["last_clicked"]["lat"]
|
| 196 |
+
clicked_lon = map_data["last_clicked"]["lng"]
|
| 197 |
+
|
| 198 |
+
# Eğer tıklanan koordinat mevcut koordinattan farklıysa güncelle
|
| 199 |
+
if abs(clicked_lat - lat) > 0.0001 or abs(clicked_lon - lon) > 0.0001:
|
| 200 |
+
st.session_state["lat"] = clicked_lat
|
| 201 |
+
st.session_state["lon"] = clicked_lon
|
| 202 |
+
st.session_state["location_name"] = f"Seçilen Nokta ({clicked_lat:.4f}, {clicked_lon:.4f})"
|
| 203 |
+
st.rerun()
|
| 204 |
else:
|
| 205 |
components.html(m._repr_html_(), height=550)
|
| 206 |
|
| 207 |
# --- TAB 2: 3D ARAZİ MODELİ (DEM EXAGGERATED) ---
|
| 208 |
with tab2:
|
| 209 |
+
st.subheader(f"3D Topoğrafya & Yüzey Modeli ({st.session_state['location_name']})")
|
| 210 |
|
| 211 |
col_dem1, col_dem2 = st.columns([3, 1])
|
| 212 |
|
| 213 |
with col_dem1:
|
| 214 |
+
grid_size = 35
|
|
|
|
| 215 |
x = np.linspace(-2, 2, grid_size)
|
| 216 |
y = np.linspace(-2, 2, grid_size)
|
| 217 |
X, Y = np.meshgrid(x, y)
|
| 218 |
+
|
| 219 |
+
# Koordinata özel 3D topoğrafik dalgalanma üretimi
|
| 220 |
+
Z = (avg_elevation + (slope_pct * 2) * np.sin(X + seed) + 15 * np.cos(Y * 1.5) + (X**2 + Y**2) * 3) * z_exaggeration
|
| 221 |
|
| 222 |
fig_3d = go.Figure(data=[go.Surface(z=Z, colorscale='Earth', showscale=True)])
|
| 223 |
fig_3d.update_layout(
|
| 224 |
+
title=f"3D Yükseklik Yüzeyi (Z-Abartı Faktörü: {z_exaggeration}x)",
|
| 225 |
autosize=True,
|
| 226 |
scene=dict(
|
| 227 |
+
xaxis_title='X (Metre)',
|
| 228 |
+
yaxis_title='Y (Metre)',
|
| 229 |
zaxis_title='Rakım (m)',
|
| 230 |
aspectratio=dict(x=1, y=1, z=0.5)
|
| 231 |
),
|
|
|
|
| 235 |
st.plotly_chart(fig_3d, use_container_width=True)
|
| 236 |
|
| 237 |
with col_dem2:
|
| 238 |
+
st.markdown("### 🏔️ Topoğrafik Özet")
|
| 239 |
+
st.info(f"**Ortalama Rakım:** {avg_elevation} m\n\n**Maksimum Eğim:** %{slope_pct}\n\n**Zemin Yapısı:** {selected_rock}")
|
| 240 |
+
if slope_pct > 12.0:
|
| 241 |
+
st.warning("⚠️ **Eğim Uyarısı:** Parselde yüksek kot farkı ve eğim bulunmaktadır. Hafriyat ve istinat projeksiyonu önerilir.")
|
| 242 |
+
else:
|
| 243 |
|
| 244 |
+
st.success("✅ **Düşük Eğim:** Arazi düz/az eğimli yapılaşmaya uygundur.")
|
| 245 |
+
|
| 246 |
+
# --- TAB 3: JEOLOJİK KOLON KESİTİ ---
|
| 247 |
with tab3:
|
| 248 |
+
st.subheader("Tahmini Stratigrafik Kolon Kesiti")
|
|
|
|
| 249 |
|
| 250 |
col_geo1, col_geo2 = st.columns([2, 1])
|
| 251 |
|
| 252 |
with col_geo1:
|
|
|
|
| 253 |
layers_df = pd.DataFrame({
|
| 254 |
+
"Katman": ["Bitkisel Toprak", "Üst Sert Kil / Alüvyon", f"Ayrışmış {selected_rock}", f"Masif {selected_rock} (Ana Kaya)"],
|
| 255 |
+
"Kalınlık (m)": [1.2, round(water_table_min * 0.3, 1), round(water_table_min * 0.6, 1), 25.0],
|
| 256 |
+
"SPT (N60)": ["4 - 8", "12 - 18", "25 - 45", ">50 (Refü)"],
|
| 257 |
+
"Renk": ["#8B5A2B", "#CD853F", "#D2B48C", "#708090"]
|
|
|
|
| 258 |
})
|
| 259 |
|
| 260 |
fig_strat = px.bar(
|
|
|
|
| 265 |
color="Katman",
|
| 266 |
text="SPT (N60)",
|
| 267 |
color_discrete_sequence=layers_df["Renk"].tolist(),
|
| 268 |
+
title="Derinlik Katmanları ve SPT Direnç Değerleri"
|
| 269 |
)
|
| 270 |
fig_strat.update_layout(height=400, showlegend=False)
|
| 271 |
st.plotly_chart(fig_strat, use_container_width=True)
|
| 272 |
|
| 273 |
with col_geo2:
|
| 274 |
+
st.markdown("### 💧 Yeraltı Suyu Bilgisi")
|
| 275 |
+
st.markdown(f"""
|
| 276 |
+
* **Tahmini Statik Su Kotu:** {water_table_min} metre
|
| 277 |
+
* **Dinamik Su Seviyesi:** {water_table_max} metre
|
| 278 |
+
* **Önerilen Sondaj Derinliği:** {water_table_max + 25} metre
|
| 279 |
+
* **Formasyon:** {selected_rock} Akifer Yapısı
|
| 280 |
""")
|
| 281 |
|
| 282 |
+
# --- TAB 4: TIJBA JEOLOJİ SOSYAL AĞI ---
|
| 283 |
with tab4:
|
| 284 |
+
st.subheader("🌐 TIJBA - Bölgesel Saha Akışı & Geoteknik Sosyal Ağ")
|
|
|
|
| 285 |
|
| 286 |
col_tij1, col_tij2 = st.columns([2, 1])
|
| 287 |
|
| 288 |
with col_tij1:
|
| 289 |
+
with st.expander(f"➕ {st.session_state['location_name']} İçi Konum Etiketli Paylaşım Yap"):
|
| 290 |
+
post_text = st.text_area("Saha gözlemi veya zemin etüt notunuz:", placeholder="Örn: Sondajda 12. metrede su çıktı...")
|
| 291 |
+
uploaded_file = st.file_uploader("Sondaj Logu / PDF Yükle", type=["png", "jpg", "pdf"])
|
| 292 |
+
if st.button("TIJBA Ağında Yayınla"):
|
| 293 |
+
st.success("✅ Gözleminiz seçili koordinat etiketli olarak TIJBA veritabanına eklendi!")
|
|
|
|
| 294 |
|
| 295 |
st.divider()
|
| 296 |
+
st.markdown(f"### 📰 {st.session_state['location_name']} Çevresindeki Paylaşımlar")
|
| 297 |
|
|
|
|
| 298 |
posts = [
|
| 299 |
{
|
| 300 |
+
"user": "Jeo. Müh. Mehmet Can",
|
| 301 |
"role": "Saha Mühendisi",
|
| 302 |
+
"time": "3 saat önce",
|
| 303 |
+
"dist": "250m yakınında",
|
| 304 |
+
"content": f"Seçilen parsele yakın bölgede yapılan sondajda {selected_rock} tabakası tespit edilmiştir.",
|
| 305 |
+
"likes": 18
|
| 306 |
},
|
| 307 |
{
|
| 308 |
+
"user": "Dr. Selin Aksoy",
|
| 309 |
+
"role": "Geoteknik Uzmanı",
|
| 310 |
"time": "1 gün önce",
|
| 311 |
+
"dist": "500m yakınında",
|
| 312 |
+
"content": f"Bölgede su seviyesi ortalama {water_table_min}m civarındadır. Temel kazısında yeraltı suyuna dikkat edilmeli.",
|
| 313 |
+
"likes": 32
|
| 314 |
}
|
| 315 |
]
|
| 316 |
|
|
|
|
| 320 |
<span class="badge-geo">{p['role']}</span> <b>{p['user']}</b>
|
| 321 |
<span style="color:gray; font-size:0.8em;">• {p['time']} ({p['dist']})</span>
|
| 322 |
<p style="margin-top:8px;">{p['content']}</p>
|
| 323 |
+
<small>❤️ {p['likes']} Mühendis Onayladı</small>
|
| 324 |
</div>
|
| 325 |
""", unsafe_allow_html=True)
|
| 326 |
|
| 327 |
with col_tij2:
|
| 328 |
+
st.markdown("### 🏆 Bölgesel Katkıda Bulunanlar")
|
| 329 |
st.markdown("""
|
| 330 |
+
1. 🥇 **Jeo. Müh. Mehmet C.** (34 Katkı)
|
| 331 |
+
2. 🥈 **Dr. Selin A.** (21 Katkı)
|
| 332 |
+
3. 🥉 **GeoTek Laboratuvarı** (15 Log)
|
| 333 |
""")
|
|
|
|
| 334 |
|
| 335 |
# -----------------------------------------------------------------------------
|
| 336 |
+
# FOOTER
|
| 337 |
# -----------------------------------------------------------------------------
|
| 338 |
st.divider()
|
| 339 |
+
st.caption("© 2026 BoraPalyAI & TIJBA GeoTech Platformu | Tüm Türkiye İçin Açık Harita Servisleri Entegre Edilmiştir.")
|