gpt4 book ai didi

python - 大叶和经络 180 和 -180

转载 作者:行者123 更新时间:2023-12-01 08:34:50 25 4
gpt4 key购买 nike

我想使用 Folium 绘制东京和洛杉矶之间太平洋上空的航类,并将 map 以太平洋为中心。但在 180 度经线和 -180 度经线之间,这些点没有正确连接(见图 1)。我想要的如图2所示。

图1: enter image description here

图2: enter image description here

代码:

import folium
points = [[35.7652, 140.3855], [40, 180], [40, -180], [33.9425, -118.4080]]
map = folium.Map(location=[0, 180], zoom_start=2)
folium.PolyLine(points, color="red", weight=2.5).add_to(map)
map.save("myMap.html")

最佳答案

感谢@Bob Haffner 的有用帮助。诀窍是为负经度添加 360

import folium
points = [[35.7652, 140.3855], [40, 180], [40, 360 -180], [33.9425, 360 -118.4080]]
map = folium.Map(location=[0, 180], zoom_start=2)
folium.PolyLine(points, color="red", weight=2.5).add_to(map)
map.save("myMap.html")

enter image description here

关于python - 大叶和经络 180 和 -180,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53772047/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com