{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
Make this Notebook Trusted to load map: File -> Trust Notebook
" ], "text/plain": [ "" ] }, "execution_count": 1, "metadata": {}, "output_type": "execute_result" } ], "source": [ "import folium\n", "from folium import plugins\n", "\n", "\n", "m = folium.Map([30, 0], zoom_start=3)\n", "\n", "wind_locations = [\n", " [59.35560, -31.992190],\n", " [55.178870, -42.89062],\n", " [47.754100, -43.94531],\n", " [38.272690, -37.96875],\n", " [27.059130, -41.13281],\n", " [16.299050, -36.56250],\n", " [8.4071700, -30.23437],\n", " [1.0546300, -22.50000],\n", " [-8.754790, -18.28125],\n", " [-21.61658, -20.03906],\n", " [-31.35364, -24.25781],\n", " [-39.90974, -30.93750],\n", " [-43.83453, -41.13281],\n", " [-47.75410, -49.92187],\n", " [-50.95843, -54.14062],\n", " [-55.97380, -56.60156],\n", "]\n", "\n", "wind_line = folium.PolyLine(wind_locations, weight=15, color=\"#8EE9FF\").add_to(m)\n", "\n", "attr = {\"fill\": \"#007DEF\", \"font-weight\": \"bold\", \"font-size\": \"24\"}\n", "\n", "plugins.PolyLineTextPath(\n", " wind_line, \") \", repeat=True, offset=7, attributes=attr\n", ").add_to(m)\n", "\n", "danger_line = folium.PolyLine(\n", " [[-40.311, -31.952], [-12.086, -18.727]], weight=10, color=\"orange\", opacity=0.8\n", ").add_to(m)\n", "\n", "attr = {\"fill\": \"red\"}\n", "\n", "plugins.PolyLineTextPath(\n", " danger_line, \"\\u25BA\", repeat=True, offset=6, attributes=attr\n", ").add_to(m)\n", "\n", "plane_line = folium.PolyLine(\n", " [[-49.38237, -37.26562], [-1.75754, -14.41406], [51.61802, -23.20312]],\n", " weight=1,\n", " color=\"black\",\n", ").add_to(m)\n", "\n", "attr = {\"font-weight\": \"bold\", \"font-size\": \"24\"}\n", "\n", "plugins.PolyLineTextPath(\n", " plane_line, \"\\u2708 \", repeat=True, offset=8, attributes=attr\n", ").add_to(m)\n", "\n", "\n", "line_to_new_delhi = folium.PolyLine(\n", " [\n", " [46.67959447, 3.33984375],\n", " [46.5588603, 29.53125],\n", " [42.29356419, 51.328125],\n", " [35.74651226, 68.5546875],\n", " [28.65203063, 76.81640625],\n", " ]\n", ").add_to(m)\n", "\n", "\n", "line_to_hanoi = folium.PolyLine(\n", " [\n", " [28.76765911, 77.60742188],\n", " [27.83907609, 88.72558594],\n", " [25.68113734, 97.3828125],\n", " [21.24842224, 105.77636719],\n", " ]\n", ").add_to(m)\n", "\n", "\n", "plugins.PolyLineTextPath(line_to_new_delhi, \"To New Delhi\", offset=-5).add_to(m)\n", "\n", "\n", "plugins.PolyLineTextPath(line_to_hanoi, \"To Hanoi\", offset=-5).add_to(m)\n", "\n", "m" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
Make this Notebook Trusted to load map: File -> Trust Notebook
" ], "text/plain": [ "" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "m = folium.Map()\n", "\n", "folium.plugins.AntPath(\n", " locations=wind_locations, reverse=\"True\", dash_array=[20, 30]\n", ").add_to(m)\n", "\n", "m.fit_bounds(m.get_bounds())\n", "\n", "m" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.9.0" } }, "nbformat": 4, "nbformat_minor": 1 }