2016-08-23 985 views
5

我Jupyter筆記本Server上運行大青葉0.2.1' 與Python 4.2.1 2.7.11是否可以在Folium地圖中繪製帶箭頭的線條?

我試圖在地圖上繪製線條,它有一個箭頭,傳達方向

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 有沒有辦法在線上添加箭頭?

回答

1

你可以使用一個正多邊形標誌畫在終點處的三角形...

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

你將不得不使用一些三角函數計算旋轉角度爲三角形的點正確的方向。任何這樣的標記點的初始點都是東向的。