-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgis.py
570 lines (504 loc) · 28.3 KB
/
gis.py
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
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
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
import streamlit as st
import folium
from streamlit_folium import folium_static
import pandas as pd
import geopandas as gpd
import io
# Set Streamlit page
st.set_page_config(layout="wide")
start_choice = st.selectbox("Overview or Start?", ["Overview", "Start!"])
if start_choice == "Overview":
st.markdown("## What can we do with these maps?")
st.markdown("* 1. View dataframe of jordan")
st.markdown("* 2. Visualize data on a map")
st.markdown("* 3. Filter data based on certain attributes and visualize it on a map")
st.markdown("* 4. Download (filtered) dataset")
st.title('Jordan Public Datasets')
type_choice = st.selectbox("Choose a map", ["Please select a map type", "Household", "Climate","Healthcare","Administrative"])
if type_choice in ["Household"]:
st.image("overview/Average Household Size in Jordan.png", use_column_width=True)
if type_choice in ["Climate"]:
st.markdown("## Jordan SPI")
st.image("overview/spi.png", use_column_width=True)
if type_choice in ["Healthcare"]:
st.image("overview/Health_jordan.png", use_column_width=True)
st.image("overview/Healthcare Facilities in Jordan.png", use_column_width=True)
st.image("overview/jordan health activities.png", use_column_width=True)
st.image("overview/Jordan Health EPE.png", use_column_width=True)
st.image("overview/Jordan Health.png", use_column_width=True)
if type_choice in ["Administrative"]:
st.image("overview/Jordan Boundaries.png", use_column_width=True)
st.image("overview/Jordan Purchasing Power.png", use_column_width=True)
st.image("overview/jordan soviet.png", use_column_width=True)
if start_choice == "Start!":
st.title("Map Visualization")
# Choose map type with dropdown
map_type_choice = st.selectbox("Choose a type", ["Please select a map type", "Household", "Climate","Healthcare","Administrative"])
if map_type_choice in ["Household"]:
map_choice1 = st.selectbox("Choose a map", ["Please select a map type", "Average Household Size in Jordan States", "Average Household Size in Jordan"])
# Display other functionalities only if a map type is selected
if map_choice1 in ["Average Household Size in Jordan States", "Average Household Size in Jordan"]:
# Function to read, clean, and merge data
def prepare_data(csv_path, shp_path):
csv_data = pd.read_csv(csv_path)
shp_data = gpd.read_file(shp_path)
csv_data['name'] = csv_data['name'].str.strip() # Remove leading/trailing spaces
shp_data['name'] = shp_data['name'].str.strip()
merged_data = shp_data.merge(csv_data, on='name')
id_name_df = pd.DataFrame({'ID': merged_data['ID'], 'name': merged_data['name']})
return gpd.GeoDataFrame(merged_data, geometry='geometry'), id_name_df
# Function to create Folium map and add GeoDataFrame
def create_map(gdf, column_name):
m = folium.Map(location=[31.95, 35.91], zoom_start=8)
choropleth = folium.Choropleth(
geo_data=gdf,
name='choropleth',
data=gdf,
columns=['name', column_name],
key_on='feature.properties.name',
fill_color='YlGn',
fill_opacity=0.7,
line_opacity=0.2,
legend_name='Legend Name',
highlight=True,
line_color='black',
line_weight=1,
tooltip=folium.features.GeoJsonTooltip(fields=['name', 'ID', column_name], labels=True, sticky=True)
).add_to(m)
folium.GeoJson(gdf, name='geojson', tooltip=folium.features.GeoJsonTooltip(fields=['name', "TOTPOP_CY"])).add_to(m)
return m
# Generate gdf and ID name reference table
if map_choice1 == "Average Household Size in Jordan States":
gdf_jstates, id_name_df = prepare_data("dataset/Average Household Size in Jordan/governorate.csv", "jordan_admin_regions.shp")
gdf = gdf_jstates
elif map_choice1 == "Average Household Size in Jordan":
gdf_jordan, id_name_df = prepare_data("dataset/Average Household Size in Jordan/country.csv", "jordan_admin_regions.shp")
gdf = gdf_jordan
# Layout columns
col1, col2, col3 = st.columns([1, 5, 1])
# Display ID and name reference table
with col1:
st.subheader("ID and Name Reference Table")
st.dataframe(id_name_df, width=250)
# Add filters
with col2:
selected_column = st.selectbox("Select a column to filter", gdf.columns[18:])
filter_values = st.multiselect("Select values to keep", gdf[selected_column].unique())
if filter_values:
filtered_gdf = gdf[gdf[selected_column].isin(filter_values)].copy()
else:
filtered_gdf = gdf.copy()
generate_map = st.button("Generate Map")
with col3:
param = pd.read_csv("dataset/Average Household Size in Jordan/para.csv")
st.subheader("Parameter Reference Table")
st.dataframe(param, width=250)
# Display map when 'Generate Map' button is clicked
if generate_map:
with col2:
if map_choice1 == "Average Household Size in Jordan States":
map_to_display = create_map(filtered_gdf, selected_column)
elif map_choice1 == "Average Household Size in Jordan":
map_to_display = create_map(gdf_jordan, selected_column)
folium_static(map_to_display, width=1087, height=600)
st.subheader("Generated GeoDataFrame")
filtered_gdf['geometry'] = filtered_gdf['geometry'].astype(str)
st.dataframe(filtered_gdf, width=1300)
if map_type_choice in ["Climate"]:
map_choice2 = st.selectbox("Choose a map", ["Please select a map type", "Jordan Standardized Precipitation Index"])
# Choose map type with dropdown
if map_choice2 in ["Jordan Standardized Precipitation Index"]:
def load_data(csv_path):
data = pd.read_csv(csv_path)
return data
# Function to create map
def create_map(gdf, selected_column, tooltips):
gdf = gpd.GeoDataFrame(gdf, geometry=gpd.points_from_xy(gdf.Longitude, gdf.Latitude))
gdf.crs = "EPSG:4326"
m = gdf.explore(
column=selected_column,
cmap="Blues",
scheme="FisherJenks",
tiles="CartoDB dark_matter",
tooltip=tooltips,
popup=True,
k=6,
highlight=True,
width="100%",
legend_kwds={"caption": f"{selected_column} Statistics"},
style_kwds={'radius': 8}
)
return m
# Main data loading
df = load_data("170/SPI_JMD_data_corrected_long_format.csv")
# Time selector
time_options = list(df['Time'].unique())
time_options.insert(0, 'all')
selected_time = st.selectbox('Select Time:', time_options)
# Filter data based on selected time
if selected_time != 'all':
df_filtered = df[df['Time'] == selected_time]
else:
df_filtered = df
st.subheader("Map Display:")
map_column = st.selectbox('Select a column to map:', df_filtered.columns)
tooltip_options = st.multiselect('Point Information:', df_filtered.columns)
map_gdf = create_map(df_filtered, map_column, tooltip_options)
folium_static(map_gdf, width=800, height=600)
# Display filtered data
st.subheader("Filtered Results:")
st.dataframe(df_filtered)
# Group and attribute selectors
group_by_attribute = st.selectbox('Group By Attribute:', df.columns)
calc_attribute = st.selectbox('Calculate Attribute:', df.columns)
# Calculate statistics
if st.button('Calculate Statistics'):
aggregation_functions = {
calc_attribute: ['max', 'min', 'mean'],
'Latitude': 'first',
'Longitude': 'first'
}
grouped_df = df.groupby(group_by_attribute).agg(aggregation_functions).reset_index()
grouped_df.columns = [col[0] if col[-1] == '' or col[-1] == 'first' else '_'.join(col) for col in grouped_df.columns.values]
st.dataframe(grouped_df)
# Map related selectors
map_column = st.selectbox('Select a column to map:', grouped_df.columns)
tooltip_options = st.multiselect('Point Information:', grouped_df.columns)
if map_type_choice in ["Healthcare"]:
map_choice3 = st.selectbox("Choose a map", ["Please select a map type", "Healthcare Facilities in Jordan","Jordan Health","Jordan Health Map"])
if map_choice3 in ["Healthcare Facilities in Jordan"]:
def load_data(csv_path):
data = pd.read_csv(csv_path)
return data
# Function to create map
def create_map(gdf, selected_column, tooltips):
gdf = gpd.GeoDataFrame(gdf, geometry=gpd.points_from_xy(gdf.Longitude, gdf.Latitude))
gdf.crs = "EPSG:4326"
m = gdf.explore(
column=selected_column,
cmap="Blues",
scheme="FisherJenks",
tiles="CartoDB dark_matter",
tooltip=tooltips,
popup=True,
k=1,
highlight=True,
width="100%",
legend_kwds={"caption": f"{selected_column} Statistics"},
style_kwds={'radius': 8}
)
return m
# Main data loading
df = load_data("dataset/Healthcare Facilities in Jordan/healthcare.csv")
# Filter selector
filter_column = st.selectbox('Select a column to filter by:', df.columns)
filter_value_options = df[filter_column].unique().tolist()
filter_value_options.insert(0, "Choose a value")
selected_value = st.selectbox(f'Choose a value for {filter_column} filtering:', filter_value_options)
if selected_value != "Choose a value":
df_filtered = df[df[filter_column] == selected_value]
else:
df_filtered = df
st.subheader("Map Display:")
map_column = st.selectbox('Select a column to map:', df_filtered.columns)
tooltip_options = st.multiselect('Point Information:', df_filtered.columns)
map_gdf = create_map(df_filtered, map_column, tooltip_options)
folium_static(map_gdf, width=800, height=600)
# Display filtered data
st.subheader("Filtered Results:")
st.dataframe(df_filtered)
if map_choice3 in ["Jordan Health"]:
def prepare_data(csv_path, shp_path):
csv_data = pd.read_csv(csv_path)
shp_data = gpd.read_file(shp_path)
csv_data['name'] = csv_data['name'].str.strip() # Remove leading/trailing spaces
shp_data['name'] = shp_data['name'].str.strip()
merged_data = shp_data.merge(csv_data, on='name')
id_name_df = pd.DataFrame({'ID': merged_data['ID'], 'name': merged_data['name']})
return gpd.GeoDataFrame(merged_data, geometry='geometry'), id_name_df
def create_map(gdf1,gdf, column_name):
gdf1.crs = "EPSG:4326"
m = gdf1.explore(
column="Name",
cmap="Blues",
scheme="FisherJenks",
tiles="CartoDB dark_matter",
tooltip=["Governorat", "Type", "Number_bed"],
popup=True,
highlight=True,
width="50%",
style_kwds={'radius': 8}
)
folium.Choropleth(
geo_data=gdf,
name='choropleth',
data=gdf,
columns=['name', column_name],
key_on='feature.properties.name',
fill_color='YlGn',
fill_opacity=0.7,
line_opacity=0.2,
legend_name='Legend Name',
highlight=True,
line_color='black',
line_weight=1,
tooltip=folium.features.GeoJsonTooltip(fields=['name', 'ID', column_name], labels=True, sticky=True)
).add_to(m)
folium.GeoJson(gdf, name='geojson', tooltip=folium.features.GeoJsonTooltip(fields=['name'])).add_to(m)
folium.LayerControl().add_to(m) # 添加图层控制
return m
gdf_jstates, id_name_df = prepare_data("dataset/Jordan Health/Governorates_jordan.csv", "jordan_admin_regions.shp")
gdf = gdf_jstates
df = pd.read_csv("dataset/Jordan Health/Hospitals.csv")
gdf1 = gpd.GeoDataFrame(df, geometry=gpd.points_from_xy(df.Longitude, df.Latitude))
# Layout columns
col1, col2, col3 = st.columns([1, 5, 1])
# Display ID and name reference table
with col1:
st.subheader("ID and Name Reference Table")
st.dataframe(id_name_df, width=250)
# Add filters
with col2:
selected_column = st.selectbox("Select a column to filter", gdf.columns)
filter_values = st.multiselect("Select values to keep", gdf[selected_column].unique())
if filter_values:
filtered_gdf = gdf[gdf[selected_column].isin(filter_values)].copy()
else:
filtered_gdf = gdf.copy()
selected_column1 = st.selectbox("Select a column to filter", gdf1.columns)
filter_values1 = st.multiselect("Select values to keep", gdf1[selected_column1].unique())
if filter_values1:
filtered_gdf1 = gdf1[gdf1[selected_column1].isin(filter_values1)].copy()
else:
filtered_gdf1 = gdf1.copy()
generate_map = st.button("Generate Map")
# Display map when 'Generate Map' button is clicked
if generate_map:
with col2:
map_to_display = create_map(filtered_gdf1,filtered_gdf, selected_column)
folium_static(map_to_display, width=1087, height=600)
st.subheader("Generated GeoDataFrame")
filtered_gdf['geometry'] = filtered_gdf['geometry'].astype(str)
st.dataframe(filtered_gdf, width=1300)
filtered_gdf1['geometry'] = filtered_gdf1['geometry'].astype(str)
st.dataframe(filtered_gdf1, width=1300)
if map_choice3 in ["Jordan Health Map"]:
def prepare_data(csv_path, shp_path):
csv_data = pd.read_csv(csv_path)
shp_data = gpd.read_file(shp_path)
csv_data['name'] = csv_data['name'].str.strip() # Remove leading/trailing spaces
shp_data['name'] = shp_data['name'].str.strip()
merged_data = shp_data.merge(csv_data, on='name')
id_name_df = pd.DataFrame({'ID': merged_data['ID'], 'name': merged_data['name']})
return gpd.GeoDataFrame(merged_data, geometry='geometry'), id_name_df
def create_map(gdf1,gdf, column_name):
gdf1.crs = "EPSG:4326"
m = gdf1.explore(
column="ID",
cmap="Blues",
scheme="FisherJenks",
tiles="CartoDB dark_matter",
tooltip=["SectorType", "Benefiting", "Governorat"],
popup=True,
highlight=True,
width="50%",
style_kwds={'radius': 8}
)
folium.Choropleth(
geo_data=gdf,
name='choropleth',
data=gdf,
columns=['name', column_name],
key_on='feature.properties.name',
fill_color='YlGn',
fill_opacity=0.7,
line_opacity=0.2,
legend_name='Legend Name',
highlight=True,
line_color='black',
line_weight=1,
tooltip=folium.features.GeoJsonTooltip(fields=['name', 'ID', column_name], labels=True, sticky=True)
).add_to(m)
folium.GeoJson(gdf, name='geojson', tooltip=folium.features.GeoJsonTooltip(fields=['name'])).add_to(m)
folium.LayerControl().add_to(m)
return m
gdf_jstates, id_name_df = prepare_data("dataset/Jordan Health Map/Governorates_jordan.csv", "jordan_admin_regions.shp")
gdf = gdf_jstates
df = pd.read_csv("dataset/Jordan Health Map/JCAP.csv")
gdf1 = gpd.GeoDataFrame(df, geometry=gpd.points_from_xy(df.Longitude, df.Latitude))
# Layout columns
col1, col2, col3 = st.columns([1, 5, 1])
# Display ID and name reference table
with col1:
st.subheader("ID and Name Reference Table")
st.dataframe(id_name_df, width=250)
# Add filters
with col2:
selected_column = st.selectbox("Select a column to filter", gdf.columns)
filter_values = st.multiselect("Select values to keep", gdf[selected_column].unique())
if filter_values:
filtered_gdf = gdf[gdf[selected_column].isin(filter_values)].copy()
else:
filtered_gdf = gdf.copy()
selected_column1 = st.selectbox("Select a column to filter", gdf1.columns)
filter_values1 = st.multiselect("Select values to keep", gdf1[selected_column1].unique())
if filter_values1:
filtered_gdf1 = gdf1[gdf1[selected_column1].isin(filter_values1)].copy()
else:
filtered_gdf1 = gdf1.copy()
generate_map = st.button("Generate Map")
if generate_map:
with col2:
map_to_display = create_map(filtered_gdf1,filtered_gdf, selected_column)
folium_static(map_to_display, width=800, height=600)
st.subheader("Generated GeoDataFrame")
filtered_gdf['geometry'] = filtered_gdf['geometry'].astype(str)
filtered_gdf = filtered_gdf.iloc[:, 18:]
st.dataframe(filtered_gdf, width=1300)
filtered_gdf1['geometry'] = filtered_gdf1['geometry'].astype(str)
st.dataframe(filtered_gdf1, width=1300)
if map_type_choice in ["Administrative"]:
map_choice1 = st.selectbox("Choose a map", ["Please select a map type", "Boundaries of Jordan States", "Boundaries of Jordan","Soviet","Jordan Purchasing Power per Capita","Jordan Purchasing Power"])
# Display other functionalities only if a map type is selected
if map_choice1 in ["Boundaries of Jordan States", "Boundaries of Jordan"]:
# Function to read, clean, and merge data
def prepare_data(csv_path, shp_path):
csv_data = pd.read_csv(csv_path)
shp_data = gpd.read_file(shp_path)
csv_data['name'] = csv_data['name'].str.strip() # Remove leading/trailing spaces
shp_data['name'] = shp_data['name'].str.strip()
merged_data = shp_data.merge(csv_data, on='ID')
id_name_df = pd.DataFrame({'ID': merged_data['ID'], 'name': merged_data['name']})
return gpd.GeoDataFrame(merged_data, geometry='geometry'), id_name_df
# Function to create Folium map and add GeoDataFrame
def create_map(gdf, column_name):
m = folium.Map(location=[31.95, 35.91], zoom_start=8)
folium.Choropleth(
geo_data=gdf,
name='choropleth',
data=gdf,
columns=['name', column_name],
key_on='feature.properties.name',
fill_color='YlGn',
fill_opacity=0.7,
line_opacity=0.2,
legend_name='Legend Name',
highlight=True,
line_color='black',
line_weight=1,
tooltip=folium.features.GeoJsonTooltip(fields=['name', 'ID', column_name], labels=True, sticky=True)
).add_to(m)
folium.GeoJson(gdf, name='geojson', tooltip=folium.features.GeoJsonTooltip(fields=['name'])).add_to(m)
return m
# Generate gdf and ID name reference table
if map_choice1 in ["Boundaries of Jordan States"]:
gdf_jstates, id_name_df = prepare_data("dataset/Jordan Boundaries/governorate.csv", "jordan_admin_regions.shp")
gdf = gdf_jstates
elif map_choice1 == "Boundaries of Jordan":
gdf_jordan, id_name_df = prepare_data("dataset/Jordan Boundaries/country.csv", "jordan_admin_regions.shp")
gdf = gdf_jordan
# Layout columns
col1, col2, col3 = st.columns([1, 5, 1])
# Display ID and name reference table
with col1:
st.subheader("ID and Name Reference Table")
st.dataframe(id_name_df,width=250)
# Add filters
with col2:
selected_column = st.selectbox("Select a column to filter", gdf.columns)
filter_values = st.multiselect("Select values to keep", gdf[selected_column].unique())
if filter_values:
filtered_gdf = gdf[gdf[selected_column].isin(filter_values)].copy()
else:
filtered_gdf = gdf.copy()
generate_map = st.button("Generate Map")
# Display map when 'Generate Map' button is clicked
if generate_map:
with col2:
if map_choice1 in ["Boundaries of Jordan States"]:
map_to_display = create_map(filtered_gdf, selected_column)
elif map_choice1 == "Boundaries of Jordan":
map_to_display = create_map(gdf_jordan, selected_column)
folium_static(map_to_display, width=800, height=600)
st.subheader("Generated GeoDataFrame")
filtered_gdf['geometry'] = filtered_gdf['geometry'].astype(str)
filtered_gdf = filtered_gdf.iloc[:, 18:]
st.dataframe(filtered_gdf, width=1300)
if map_choice1 in ["Jordan Purchasing Power per Capita","Jordan Purchasing Power"]:
# Function to read, clean, and merge data
def prepare_data(csv_path, shp_path):
csv_data = pd.read_csv(csv_path)
shp_data = gpd.read_file(shp_path)
csv_data['name'] = csv_data['name'].str.strip() # Remove leading/trailing spaces
shp_data['name'] = shp_data['name'].str.strip()
merged_data = shp_data.merge(csv_data, on='name')
id_name_df = pd.DataFrame({'ID': merged_data['ID'], 'name': merged_data['name']})
return gpd.GeoDataFrame(merged_data, geometry='geometry'), id_name_df
# Function to create Folium map and add GeoDataFrame
def create_map(gdf, column_name):
m = folium.Map(location=[31.95, 35.91], zoom_start=8)
folium.Choropleth(
geo_data=gdf,
name='choropleth',
data=gdf,
columns=['name', column_name],
key_on='feature.properties.name',
fill_color='YlGn',
fill_opacity=0.7,
line_opacity=0.2,
legend_name='Legend Name',
highlight=True,
line_color='black',
line_weight=1,
tooltip=folium.features.GeoJsonTooltip(fields=['name', 'ID', column_name], labels=True, sticky=True)
).add_to(m)
folium.GeoJson(gdf, name='geojson', tooltip=folium.features.GeoJsonTooltip(fields=['name'])).add_to(m)
return m
# Generate gdf and ID name reference table
if map_choice1 in ["Jordan Purchasing Power per Capita"]:
gdf_jstates, id_name_df = prepare_data("dataset/Jordan Purchasing Power/governorate.csv", "jordan_admin_regions.shp")
gdf = gdf_jstates
elif map_choice1 == "Jordan Purchasing Power":
gdf_jordan, id_name_df = prepare_data("dataset/Jordan Purchasing Power/country.csv", "jordan_admin_regions.shp")
gdf = gdf_jordan
# Layout columns
col1, col2, col3 = st.columns([1, 5, 1])
# Display ID and name reference table
with col1:
st.subheader("ID and Name Reference Table")
st.dataframe(id_name_df)
# Add filters
with col2:
selected_column = st.selectbox("Select a column to filter", gdf.columns)
filter_values = st.multiselect("Select values to keep", gdf[selected_column].unique())
if filter_values:
filtered_gdf = gdf[gdf[selected_column].isin(filter_values)].copy()
else:
filtered_gdf = gdf.copy()
generate_map = st.button("Generate Map")
# Display map when 'Generate Map' button is clicked
if generate_map:
with col2:
if map_choice1 in ["Jordan Purchasing Power per Capita"]:
map_to_display = create_map(filtered_gdf, selected_column)
elif map_choice1 == "Jordan Purchasing Power":
map_to_display = create_map(gdf_jordan, selected_column)
folium_static(map_to_display, width=800, height=600)
st.subheader("Generated GeoDataFrame")
filtered_gdf['geometry'] = filtered_gdf['geometry'].astype(str)
filtered_gdf = filtered_gdf.iloc[:, 18:]
st.dataframe(filtered_gdf, width=1300)
with col3:
param = pd.read_csv("dataset/Average Household Size in Jordan/para.csv")
st.subheader("Parameter Reference Table")
st.dataframe(param, width=250)
if map_choice1 in ["Soviet"]:
gdf = gpd.read_file("dataset/Soviet/layer_0.shp")
generate_map = st.button("Generate Map")
if generate_map:
with st.spinner("Generating map..."):
m = gdf.explore()
folium_static(m, width=800, height=600)
st.subheader("Generated GeoDataFrame")
gdf['geometry'] = gdf['geometry'].astype(str)
st.dataframe(gdf, width=1300)