|
3 | 3 |
|
4 | 4 | from streamlit_folium import st_folium
|
5 | 5 |
|
| 6 | + |
6 | 7 | def run_server():
|
7 | 8 | st.title('Rowerem przez Małopolskę')
|
8 | 9 |
|
| 10 | + cont1 = st.container() |
| 11 | + |
| 12 | + with cont1: |
| 13 | + col1, col2 = st.columns(2) |
| 14 | + |
| 15 | + with col1: |
| 16 | + st.text_input("Skąd") |
| 17 | + |
| 18 | + with col2: |
| 19 | + st.text_input("Dokąd") |
| 20 | + |
| 21 | + cont2 = st.container() |
| 22 | + |
| 23 | + map_bound_coordinates=[ |
| 24 | + (50.581493, 17.803345), |
| 25 | + (50.581493, 22.884521), |
| 26 | + (48.915280, 22.884521), |
| 27 | + (48.915280, 17.803345), |
| 28 | + (50.581493, 17.803345), |
| 29 | + ] |
| 30 | + |
9 | 31 | # center on Liberty Bell, add marker
|
10 |
| - map = folium.Map(location=[39.949610, -75.150282], zoom_start=16) |
11 |
| - marker = folium.Marker([39.949610, -75.150282], popup='Liberty Bell', tooltip='Liberty Bell') |
12 |
| - marker.add_to(map) |
| 32 | + map = folium.Map( |
| 33 | + max_bounds=True, |
| 34 | + location=[50.049683, 19.944544], |
| 35 | + zoom_start=9, |
| 36 | + min_lat=48.915280, |
| 37 | + max_lat=50.581493, |
| 38 | + min_lon=17.803345, |
| 39 | + max_lon=22.884521, |
| 40 | + tiles='OpenStreetMap' |
| 41 | + # min_lon=19.076385, |
| 42 | + # max_lon=21.432953, |
| 43 | + # min_lat=49.174522, |
| 44 | + # max_lat=50.526524 |
| 45 | + ) |
| 46 | + marker = folium.Marker([50.049683, 19.944544], popup='Kraków', tooltip='Kraków') |
| 47 | + map.add_child(marker) |
| 48 | + |
| 49 | + map_bounds=folium.PolyLine(locations=map_bound_coordinates, weight=5) |
| 50 | + |
| 51 | + map.add_child(map_bounds) |
13 | 52 |
|
14 |
| - # call to render Folium map in Streamlit |
15 |
| - st_data = st_folium(map, width=725) |
| 53 | + with cont2: |
| 54 | + # call to render Folium map in Streamlit |
| 55 | + st_data = st_folium(map, width=725) |
16 | 56 |
|
17 | 57 |
|
18 | 58 | if __name__ == '__main__':
|
|
0 commit comments