Anne314159 commited on
Commit
71a4b8d
·
verified ·
1 Parent(s): 693c1c1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -38
app.py CHANGED
@@ -135,45 +135,30 @@ def page_article_to_social_post():
135
  st.write(post_content)
136
 
137
  def page_vaccation():
138
- import streamlit as st
139
- import pandas as pd
140
- import pydeck as pdk
141
-
142
- # Input for start and end points
143
- start_point = st.text_input("Enter start point", "Location A")
144
- end_point = st.text_input("Enter end point", "Location B")
145
-
146
- # Assume function to calculate route and places of interest (mock data for demonstration)
147
- # You would replace this with real data obtained from mapping APIs
148
- route_data = pd.DataFrame({
149
- 'lat': [start_lat, end_lat],
150
- 'lon': [start_lon, end_lon]
151
- })
152
- places_of_interest = pd.DataFrame({
153
- 'lat': [poi1_lat, poi2_lat], # Latitudes of places of interest
154
- 'lon': [poi1_lon, poi2_lon], # Longitudes of places of interest
155
- 'name': ['Place 1', 'Place 2'] # Names of places of interest
156
- })
157
 
158
- # Display the map
159
- st.pydeck_chart(pdk.Deck(
160
- map_style='mapbox://styles/mapbox/light-v9',
161
- initial_view_state=pdk.ViewState(
162
- latitude=route_data['lat'].mean(),
163
- longitude=route_data['lon'].mean(),
164
- zoom=11,
165
- pitch=50,
166
- ),
167
- layers=[
168
- pdk.Layer(
169
- 'ScatterplotLayer',
170
- data=places_of_interest,
171
- get_position='[lon, lat]',
172
- get_color='[200, 30, 0, 160]',
173
- get_radius=200,
174
- ),
175
- ],
176
- ))
177
 
178
 
179
  # Setup the sidebar with page selection
 
135
  st.write(post_content)
136
 
137
  def page_vaccation():
138
+
139
+ st.title("Map Display with Start and End Points")
140
+
141
+ # Collect user inputs for latitude and longitude of start and end points
142
+ st.header("Start Point")
143
+ start_lat = st.number_input("Start Latitude", value=37.76, format="%.6f")
144
+ start_lon = st.number_input("Start Longitude", value=-122.4, format="%.6f")
 
 
 
 
 
 
 
 
 
 
 
 
145
 
146
+ st.header("End Point")
147
+ end_lat = st.number_input("End Latitude", value=37.76, format="%.6f")
148
+ end_lon = st.number_input("End Longitude", value=-122.41, format="%.6f")
149
+
150
+ # Prepare data for the map
151
+ if start_lat and start_lon and end_lat and end_lon:
152
+ points_df = pd.DataFrame({
153
+ 'lat': [start_lat, end_lat],
154
+ 'lon': [start_lon, end_lon],
155
+ 'color': ['#ff0000', '#0000ff'], # Start in red, end in blue
156
+ 'size': [100, 100] # Size of the points
157
+ })
158
+
159
+ # Display the map with customized points
160
+ st.map(data=points_df, latitude='lat', longitude='lon', color='color', size='size')
161
+
 
 
 
162
 
163
 
164
  # Setup the sidebar with page selection