Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -101,21 +101,31 @@ st.markdown(
|
|
101 |
@st.cache_data
|
102 |
def load_initial_data():
|
103 |
data = {
|
104 |
-
'مزرعه': ['17-
|
105 |
-
'کانال': ['
|
106 |
-
'
|
107 |
-
'
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
'چاهک_1_تاریخ': ['1404/01/
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
'چاهک
|
116 |
-
|
117 |
-
|
118 |
-
'چاهک
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
119 |
}
|
120 |
return pd.DataFrame(data)
|
121 |
|
@@ -212,9 +222,13 @@ st.markdown(
|
|
212 |
unsafe_allow_html=True
|
213 |
)
|
214 |
|
|
|
|
|
|
|
|
|
215 |
m = folium.Map(
|
216 |
-
location=[
|
217 |
-
zoom_start=
|
218 |
tiles='https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}',
|
219 |
attr='Esri',
|
220 |
name='Satellite'
|
@@ -251,18 +265,22 @@ m.get_root().header.add_child(folium.Element(f'<style>{pulse_css}</style>'))
|
|
251 |
for idx, row in filtered_data.iterrows():
|
252 |
if row['چاهک_1_نصب'] and row['چاهک_1_lat'] != 0:
|
253 |
popup_html = f"""
|
254 |
-
<div style='direction: rtl; text-align: right; padding: 10px;'>
|
255 |
-
<h4 style='color: #0083B0; margin: 0;
|
256 |
-
|
257 |
-
|
258 |
-
<
|
259 |
-
|
|
|
|
|
|
|
|
|
260 |
</div>
|
261 |
"""
|
262 |
|
263 |
folium.CircleMarker(
|
264 |
location=[row['چاهک_1_lat'], row['چاهک_1_lon']],
|
265 |
-
radius=
|
266 |
popup=folium.Popup(popup_html, max_width=300),
|
267 |
color='#0083B0',
|
268 |
fill=True,
|
|
|
101 |
@st.cache_data
|
102 |
def load_initial_data():
|
103 |
data = {
|
104 |
+
'مزرعه': ['06-10', '10-15', '12-27', '24-04', '22-21', '20-05', '14-21', '14-19', '14-24', '14-18', '22-17', '16-13', '16-27', '02-19', '02-27', '17-02', '15-22', '15-12', '15-04', '23-07'],
|
105 |
+
'کانال': ['06', '10', '12', '24', '22', '20', '14', '14', '14', '14', '22', '16', '16', '02', '02', '17', '15', '15', '15', '23'],
|
106 |
+
'چاهک_1_نصب': [True] * 20,
|
107 |
+
'چاهک_1_تکنسین': ['علی دغاغله', 'علی دغاغله', 'علی دغاغله', 'مسعود بن موسی', 'مسعود بن موسی', 'مسعود بن موسی',
|
108 |
+
'علی دغاغله', 'علی دغاغله', 'مسعود بن موسی', 'علی دغاغله', 'مسعود بن موسی', 'علی دغاغله',
|
109 |
+
'مسعود بن موسی', 'مسعود بن موسی', 'مسعود بن موسی', 'علی دغاغله', 'علی دغاغله', 'علی دغاغله',
|
110 |
+
'علی دغاغله', 'علی دغاغله'],
|
111 |
+
'چاهک_1_تاریخ': ['1404/01/10', '1404/01/09', '1404/01/08', '1404/01/12', '1404/01/12', '1404/01/11',
|
112 |
+
'1404/01/10', '1404/01/09', '1404/01/11', '1404/01/09', '1404/01/10', '1404/01/12',
|
113 |
+
'1404/01/12', '1404/01/16', '1404/01/16', '1404/01/16', '1404/01/16', '1404/01/16',
|
114 |
+
'1404/01/16', '1404/01/16'],
|
115 |
+
'چاهک_1_lat': [31.578944, 31.551778, 31.535056, 31.446083, 31.459917, 31.459861, 31.516472, 31.515722,
|
116 |
+
31.525056, 31.525472, 31.458528, 31.496722, 31.498083, 31.597933, 31.600053, 31.494345,
|
117 |
+
31.510917, 31.512250, 31.513139, 31.448096],
|
118 |
+
'چاهک_1_lon': [48.731222, 48.721556, 48.703139, 48.713444, 48.703972, 48.722472, 48.707083, 48.711778,
|
119 |
+
48.707583, 48.713778, 48.706861, 48.715639, 48.698889, 48.721920, 48.711327, 48.737393,
|
120 |
+
48.766361, 48.750944, 48.740556, 48.738048],
|
121 |
+
'چاهک_2_نصب': [False] * 20,
|
122 |
+
'چاهک_2_تکنسین': [''] * 20,
|
123 |
+
'چاهک_2_تاریخ': [''] * 20,
|
124 |
+
'چاهک_2_lat': [0.0] * 20,
|
125 |
+
'چاهک_2_lon': [0.0] * 20,
|
126 |
+
'اداره': [1] * 20, # Placeholder value
|
127 |
+
'واریته': ['CP69'] * 20, # Placeholder value
|
128 |
+
'مساحت': [24.0] * 20, # Placeholder value
|
129 |
}
|
130 |
return pd.DataFrame(data)
|
131 |
|
|
|
222 |
unsafe_allow_html=True
|
223 |
)
|
224 |
|
225 |
+
# Calculate the center of all points
|
226 |
+
center_lat = filtered_data[filtered_data['چاهک_1_نصب']]['چاهک_1_lat'].mean()
|
227 |
+
center_lon = filtered_data[filtered_data['چاهک_1_نصب']]['چاهک_1_lon'].mean()
|
228 |
+
|
229 |
m = folium.Map(
|
230 |
+
location=[center_lat, center_lon],
|
231 |
+
zoom_start=12,
|
232 |
tiles='https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}',
|
233 |
attr='Esri',
|
234 |
name='Satellite'
|
|
|
265 |
for idx, row in filtered_data.iterrows():
|
266 |
if row['چاهک_1_نصب'] and row['چاهک_1_lat'] != 0:
|
267 |
popup_html = f"""
|
268 |
+
<div style='direction: rtl; text-align: right; padding: 10px; min-width: 200px;'>
|
269 |
+
<h4 style='color: #0083B0; margin: 0; border-bottom: 2px solid #0083B0; padding-bottom: 5px;'>
|
270 |
+
کانال {row['کانال']} مزرعه {row['مزرعه']}
|
271 |
+
</h4>
|
272 |
+
<div style='margin-top: 10px;'>
|
273 |
+
<p style='margin: 5px 0;'><strong>👨🌾 تکنسین:</strong> {row['چاهک_1_تکنسین']}</p>
|
274 |
+
<p style='margin: 5px 0;'><strong>📅 تاریخ نصب:</strong> {row['چاهک_1_تاریخ']}</p>
|
275 |
+
<p style='margin: 5px 0;'><strong>📍 موقعیت:</strong></p>
|
276 |
+
<p style='margin: 5px 0; direction: ltr;'>{row['چاهک_1_lat']:.6f}°N, {row['چاهک_1_lon']:.6f}°E</p>
|
277 |
+
</div>
|
278 |
</div>
|
279 |
"""
|
280 |
|
281 |
folium.CircleMarker(
|
282 |
location=[row['چاهک_1_lat'], row['چاهک_1_lon']],
|
283 |
+
radius=8,
|
284 |
popup=folium.Popup(popup_html, max_width=300),
|
285 |
color='#0083B0',
|
286 |
fill=True,
|