Anne314159 commited on
Commit
53cdd83
·
verified ·
1 Parent(s): 94dd87a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -9
app.py CHANGED
@@ -212,23 +212,26 @@ def page_vacation():
212
  # Convert the route to a DataFrame
213
  route_df = pd.DataFrame(route, columns=['lon', 'lat'])
214
 
 
 
 
215
  # Display the route using PyDeck
216
  st.pydeck_chart(pdk.Deck(
217
  map_style='mapbox://styles/mapbox/light-v9',
218
  initial_view_state=pdk.ViewState(
219
- latitude=48.5216,
220
- longitude=9.0576,
221
  zoom=11,
222
- pitch=10,
223
  ),
224
  layers=[
225
  pdk.Layer(
226
- 'LineLayer',
227
- data=route_df,
228
- get_source_position='[lon, lat]',
229
- get_target_position='[lon, lat]',
230
- get_color='[255, 0, 0, 160]',
231
- get_width=5,
232
  pickable=True
233
  ),
234
  ],
 
212
  # Convert the route to a DataFrame
213
  route_df = pd.DataFrame(route, columns=['lon', 'lat'])
214
 
215
+ # Create the route data for PyDeck, making sure each coordinate pair is a list within the 'path' list
216
+ route_data = [{'path': route}]
217
+
218
  # Display the route using PyDeck
219
  st.pydeck_chart(pdk.Deck(
220
  map_style='mapbox://styles/mapbox/light-v9',
221
  initial_view_state=pdk.ViewState(
222
+ latitude=48.5216, # This should ideally be the midpoint of the route
223
+ longitude=9.0576, # This should ideally be the midpoint of the route
224
  zoom=11,
225
+ pitch=0,
226
  ),
227
  layers=[
228
  pdk.Layer(
229
+ 'PathLayer',
230
+ data=route_data,
231
+ get_path='path',
232
+ width_scale=20,
233
+ width_min_pixels=2,
234
+ get_color=[255, 140, 0], # Color the path with a visible color
235
  pickable=True
236
  ),
237
  ],