|
import streamlit as st |
|
import pandas as pd |
|
import random |
|
import plotly.express as px |
|
from geopy.distance import geodesic |
|
from PIL import Image |
|
|
|
|
|
dmo_names = ["DMO" + str(i) for i in range(1, 31)] |
|
|
|
|
|
cities = { |
|
"London": (51.5074, -0.1278), |
|
"Paris": (48.8566, 2.3522), |
|
"Berlin": (52.5200, 13.4050), |
|
"Madrid": (40.4168, -3.7038), |
|
"Rome": (41.9028, 12.4964), |
|
"Vienna": (48.2082, 16.3738), |
|
"Amsterdam": (52.3667, 4.8945), |
|
"Athens": (37.9838, 23.7275), |
|
"Stockholm": (59.3293, 18.0686), |
|
"Brussels": (50.8503, 4.3517), |
|
"Helsinki": (60.1699, 24.9384), |
|
"Warsaw": (52.2297, 21.0122), |
|
"Copenhagen": (55.6761, 12.5683), |
|
"Lisbon": (38.7223, -9.1393), |
|
"Dublin": (53.3498, -6.2603), |
|
"Budapest": (47.4979, 19.0402), |
|
"Prague": (50.0755, 14.4378), |
|
"Sofia": (42.6977, 23.3219), |
|
"Bucharest": (44.4396, 26.0963), |
|
"Luxembourg": (49.6116, 6.1319), |
|
"Riga": (56.9496, 24.1052), |
|
"Valletta": (35.8989, 14.5146), |
|
"Vilnius": (54.6872, 25.2797), |
|
"Bratislava": (48.1486, 17.1077), |
|
"Ljubljana": (46.0569, 14.5058), |
|
"Nicosia": (35.1856, 33.3823), |
|
"Tallinn": (59.4370, 24.7536), |
|
"Zagreb": (45.8150, 15.9819), |
|
"Nicosia": (35.1856, 33.3823), |
|
"Valletta": (35.8989, 14.5146) |
|
} |
|
|
|
|
|
beach_coordinates = (45.0, 10.0) |
|
mountain_coordinates = (48.0, 10.0) |
|
|
|
|
|
def determine_area(latitude, longitude): |
|
city_coordinates = (latitude, longitude) |
|
beach_distance = geodesic(city_coordinates, beach_coordinates).km |
|
mountain_distance = geodesic(city_coordinates, mountain_coordinates).km |
|
|
|
if beach_distance <= 200: |
|
return "Beach" |
|
elif mountain_distance <= 200: |
|
return "Mountain" |
|
else: |
|
return "City" |
|
|
|
|
|
df = pd.DataFrame(columns=["DMO", "City", "Latitude", "Longitude", "Area", "Environmental", "Cultural", |
|
"Community", "Socio-economic", "Infrastructure", "Stakeholder", |
|
"Visitor_education", "Monitoring"]) |
|
|
|
|
|
for i in range(30): |
|
dmo = dmo_names[i] |
|
city = random.choice(list(cities.keys())) |
|
latitude, longitude = cities[city] |
|
area = determine_area(latitude, longitude) |
|
environmental = round(random.uniform(0, 10), 2) |
|
cultural = round(random.uniform(0, 10), 2) |
|
community = round(random.uniform(0, 10), 2) |
|
socio_economic = round(random.uniform(0, 10), 2) |
|
infrastructure = round(random.uniform(0, 10), 2) |
|
stakeholder = round(random.uniform(0, 10), 2) |
|
visitor_education = round(random.uniform(0, 10), 2) |
|
monitoring = round(random.uniform(0, 10), 2) |
|
|
|
df.loc[i] = [dmo, city, latitude, longitude, area, environmental, cultural, community, |
|
socio_economic, infrastructure, stakeholder, visitor_education, monitoring] |
|
|
|
df.loc[df['DMO'].isin(['DMO14', 'DMO19', 'DMO27', 'DMO15', 'DMO20', 'DMO21']), 'Area'] = 'Beach' |
|
df.loc[df['DMO'].isin(['DMO4', 'DMO23', 'DMO8']), 'Area'] = 'Mountain' |
|
|
|
fig = px.scatter_mapbox(df, lat="Latitude", lon="Longitude", hover_name="DMO", hover_data=["Environmental", "Cultural", |
|
"Community", "Socio-economic", |
|
"Infrastructure", "Stakeholder", |
|
"Visitor_education", "Monitoring"], |
|
color="Area", color_discrete_sequence=["blue", "green", "red"], zoom=3) |
|
|
|
fig.update_layout(mapbox_style="open-street-map") |
|
fig.update_layout(margin={"r":0,"t":0,"l":0,"b":0}) |
|
|
|
st.plotly_chart(fig, use_container_width=True) |
|
|
|
img = Image.open('mastercard_logo.png') |
|
|
|
col1, col2, col3 = st.columns([1,6,1]) |
|
|
|
with col1: |
|
st.write("") |
|
|
|
with col2: |
|
st.write("") |
|
|
|
with col3: |
|
st.image(img) |
|
|