我正在尝试使用大叶草在地图上绘制给定的坐标的方位角。我是python的新手,我迷路了。 目的是获取坐标和度并将其绘制到地图上。 我正在尝试使用大叶草,但不一定是大叶草。
import folium
# criar o objeto do mapa
m = folium.Map(location=[37.0431575, -7.8449655], zoom_start=14)
# Texto que vai aparecer no marcador
tootip = "Célula em Olhão"
folium.CircleMarker(
location=[37.040893, -7.83197],
radius=4,
popup="célula",
).add_to(m)
# posicao = folium.RegularPolygonMarker(
# location=[37.040893, -7.83197],
# fill_color='blue',
# number_of_sides=3,
# radius=10,
# rotation=45).add_to(m)
# I TRIED WITH A TRIANGULE BUT I COULDN'T UNDERSTANT WICH PART WAS
# POINTING AT THE DESIRED DIRECTION
m.save("mapa.html")
我怎样才能从45度的圆弧开始画一条线?行的大小并不重要,只需要可见即可。 谢谢
答案 0 :(得分:0)
像这样吗?
使用的帮助math
,并一些TRIG
import folium
import math
# criar o objeto do mapa
m = folium.Map(location=[37.0431575, -7.8449655], zoom_start=14)
# Texto que vai aparecer no marcador
tootip = "Célula em Olhão"
origin_point = [37.040893, -7.83197]
folium.CircleMarker(
location=origin_point,
radius=4,
popup="célula",
).add_to(m)
length = .01
angle = 45
end_lat = origin_point[0] + length * math.sin(math.radians(angle))
end_lon = origin_point[1] + length * math.cos(math.radians(angle))
folium.PolyLine([origin_point, [end_lat, end_lon]]).add_to(m)
m