4
folium.PolyLine([[34.4080345,86.0063832], [36.2044029,-113.7621932]], color="red", weight=20, opacity=0.8).add_to(my_map)

First Lat-Long is China, while the second is USA. Currently it plots the line going West (over India, Middle East, etc.) And even if I plot 3 geo-coordinates (China, Pacific Ocean, USA) it plots towards the Pacific Ocean but then back tracks back West towards USA....

1 Answers1

0

You need to check if any of your coordinates has a negative longitude. If so, then add 360 so Folium can interpret the coordinate in the "left" section of the map:

import folium

my_map = folium.Map(location=(0,180), zoom_start=2)
folium.PolyLine([[34.4080345,86.0063832], [36.2044029,-113.7621932 + 360]], color="red", weight=20, opacity=0.8).add_to(my_map)
my_map

line through Pacific Ocean