|
| 1 | +# -*- coding: utf-8 -*- |
| 2 | +import folium |
| 3 | +from folium import plugins |
| 4 | + |
| 5 | +m = folium.Map([30., 0.], zoom_start=3) |
| 6 | +wind_locations = [[59.35560, -31.992190], |
| 7 | + [55.178870, -42.89062], |
| 8 | + [47.754100, -43.94531], |
| 9 | + [38.272690, -37.96875], |
| 10 | + [27.059130, -41.13281], |
| 11 | + [16.299050, -36.56250], |
| 12 | + [8.4071700, -30.23437], |
| 13 | + [1.0546300, -22.50000], |
| 14 | + [-8.754790, -18.28125], |
| 15 | + [-21.61658, -20.03906], |
| 16 | + [-31.35364, -24.25781], |
| 17 | + [-39.90974, -30.93750], |
| 18 | + [-43.83453, -41.13281], |
| 19 | + [-47.75410, -49.92187], |
| 20 | + [-50.95843, -54.14062], |
| 21 | + [-55.97380, -56.60156]] |
| 22 | + |
| 23 | +wind_line = folium.PolyLine(wind_locations, |
| 24 | + weight=15, |
| 25 | + color='#8EE9FF').add_to(m) |
| 26 | +attr = {'fill': '#007DEF', 'font-weight': 'bold', 'font-size': '24'} |
| 27 | +plugins.PolyLineTextPath(wind_line, |
| 28 | + ") ", |
| 29 | + repeat=True, |
| 30 | + offset=7, |
| 31 | + attributes=attr).add_to(m) |
| 32 | + |
| 33 | +danger_line = folium.PolyLine([[-40.311, -31.952], |
| 34 | + [-12.086, -18.727]], |
| 35 | + weight=10, |
| 36 | + color='orange', |
| 37 | + opacity=0.8).add_to(m) |
| 38 | +attr = {'fill': 'red'} |
| 39 | +plugins.PolyLineTextPath(danger_line, |
| 40 | + "\u25BA", |
| 41 | + repeat=True, |
| 42 | + offset=6, |
| 43 | + attributes=attr).add_to(m) |
| 44 | + |
| 45 | +plane_line = folium.PolyLine([[-49.38237, -37.26562], |
| 46 | + [-1.75754, -14.41406], |
| 47 | + [51.61802, -23.20312]], |
| 48 | + weight=1, color='black').add_to(m) |
| 49 | +attr = {'font-weight': 'bold', 'font-size': '24'} |
| 50 | +plugins.PolyLineTextPath(plane_line, |
| 51 | + "\u2708 ", |
| 52 | + repeat=True, |
| 53 | + offset=8, |
| 54 | + attributes=attr).add_to(m) |
| 55 | + |
| 56 | +line_to_new_delhi = folium.PolyLine([[46.67959447, 3.33984375], |
| 57 | + [46.5588603, 29.53125], |
| 58 | + [42.29356419, 51.328125], |
| 59 | + [35.74651226, 68.5546875], |
| 60 | + [28.65203063, 76.81640625]]).add_to(m) |
| 61 | + |
| 62 | +line_to_hanoi = folium.PolyLine([[28.76765911, 77.60742188], |
| 63 | + [27.83907609, 88.72558594], |
| 64 | + [25.68113734, 97.3828125], |
| 65 | + [21.24842224, 105.77636719]]).add_to(m) |
| 66 | + |
| 67 | +plugins.PolyLineTextPath(line_to_new_delhi, |
| 68 | + "To New Delhi", |
| 69 | + offset=-5).add_to(m) |
| 70 | +plugins.PolyLineTextPath(line_to_hanoi, "To Hanoi", offset=-5).add_to(m) |
| 71 | + |
| 72 | +m.save(outfile='polyline_text.html') |
0 commit comments