Issue
I am running Folium 0.2.1' with Python 2.7.11 on Jupyter Notebook Server 4.2.1
I am trying to plot lines on a map, which have a arrowhead to convey 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)
Is there a way to add an arrowhead to the line?
Solution
You could use a regular polygon marker to draw a triangle at the end point...
folium.RegularPolygonMarker(location=(32.900908, -97.040335), fill_color='blue', number_of_sides=3, radius=10, rotation=???).add_to(m)
You'll have to use some trigonometry to calculate the angle of rotation for the triangle to point in the correct direction. The initial point of any such marker points due east.
Answered By - user3456239
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.