Spaces:
Sleeping
Sleeping
souvik0306
commited on
Commit
•
e49efed
1
Parent(s):
54bf19c
Refactor map_generator.py: Update legend styling and position
Browse files- map_generator.py +28 -7
map_generator.py
CHANGED
@@ -69,15 +69,36 @@ def create_route_map(airports, lat_long_dict, optimal_route, refuel_sectors):
|
|
69 |
# Autoscale the map to fit all points
|
70 |
route_map.fit_bounds(bounds)
|
71 |
|
|
|
72 |
# Add custom legend as a child of the map
|
73 |
legend_html = '''
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
81 |
'''
|
82 |
route_map.get_root().html.add_child(folium.Element(legend_html))
|
83 |
|
|
|
69 |
# Autoscale the map to fit all points
|
70 |
route_map.fit_bounds(bounds)
|
71 |
|
72 |
+
# Add custom legend as a child of the map
|
73 |
# Add custom legend as a child of the map
|
74 |
legend_html = '''
|
75 |
+
<div style="
|
76 |
+
position: fixed;
|
77 |
+
bottom: 50px;
|
78 |
+
left: 50px;
|
79 |
+
width: 250px;
|
80 |
+
height: 90px;
|
81 |
+
background-color: white;
|
82 |
+
border: 2px solid grey;
|
83 |
+
z-index: 9999;
|
84 |
+
font-size: 14px;
|
85 |
+
padding: 10px;
|
86 |
+
box-shadow: 2px 2px 5px rgba(0,0,0,0.3);
|
87 |
+
">
|
88 |
+
<strong>Legend</strong><br>
|
89 |
+
<i class="fa fa-minus" style="color:red"></i> Solid line: No refuel required<br>
|
90 |
+
<i class="fa fa-ellipsis-h" style="color:red"></i> Dotted line: Refuel required
|
91 |
+
</div>
|
92 |
+
<style>
|
93 |
+
@media (max-width: 600px) {
|
94 |
+
div[style*="position: fixed"] {
|
95 |
+
bottom: 10px !important;
|
96 |
+
left: 10px !important;
|
97 |
+
width: 200px !important;
|
98 |
+
font-size: 12px !important;
|
99 |
+
}
|
100 |
+
}
|
101 |
+
</style>
|
102 |
'''
|
103 |
route_map.get_root().html.add_child(folium.Element(legend_html))
|
104 |
|