Can I draw lines with arrowheads on the folium map?

I am running Folium 0.2.1 'with Python 2.7.11 on Jupyter Notebook Server 4.2.1

I am trying to build lines on a map that have an arrow for direction

import folium #DFW, LGA coordinates coordinates=[(32.900908, -97.040335),(40.768571, -73.861603)] m = folium.Map(location=[32.900908, -97.040335], zoom_start=4) #line going from dfw to lga aline=folium.PolyLine(locations=coordinates,weight=2,color = 'blue') m.add_children(aline) 

enter image description here Is there a way to add an arrow to a string?

+5
source share
1 answer

You can use a regular polygon marker to draw a triangle at the endpoint ...

 folium.RegularPolygonMarker(location=(32.900908, -97.040335), fill_color='blue', number_of_sides=3, radius=10, rotation=???).add_to(m) 

You will need to use some trigonometry to calculate the angle of rotation so that the triangle points in the right direction. The starting point of any such marker points east.

+1
source

All Articles