기본 맵에서이 문제를 해결하기 위해 특정 경우에 당신이 결과 경로에있는 X 정점의 차이를 확인할 수 있습니다. 거기에서 우리는 나쁜 경로를 두 부분으로 나눌 수 있습니다. 나는베이스 맵과 함께이 일을 함께 내 자신의 예를 던진 :
from mpl_toolkits.basemap import Basemap
import numpy as np
import matplotlib.pyplot as plt
m = Basemap(projection='cyl', lon_0=0, resolution='c')
m.fillcontinents(color='coral',lake_color='aqua')
m.drawmapboundary(fill_color='aqua')
places = {'Mexico City': (19.05, -99.366667),
'London': (51.507222, -0.1275),
'Sydney': (-33.859972, 151.211111),
'Cape Town': (-33.925278, 18.423889),
'Delhi': (28.61, 77.23),
}
network = [
('London', 'Delhi'),
('Mexico City', 'Sydney'),
]
for source, target in network:
lat1, lon1 = places[source]
lat2, lon2 = places[target]
line, = m.drawgreatcircle(lon1, lat1, lon2, lat2, lw=3)
p = line.get_path()
# find the index which crosses the dateline (the delta is large)
cut_point = np.where(np.abs(np.diff(p.vertices[:, 0])) > 200)[0]
if cut_point:
cut_point = cut_point[0]
# create new vertices with a nan inbetween and set those as the path's vertices
new_verts = np.concatenate(
[p.vertices[:cut_point, :],
[[np.nan, np.nan]],
p.vertices[cut_point+1:, :]]
)
p.codes = None
p.vertices = new_verts
plt.show()
결과를 :

이 일반적인 해결책이 아니다, 당신은 위도와 경도가있는 경우에만 작동합니다. 일반적인 문제를 해결하는 것은 많이, 많은 것은이고 더 초점은 cartopy (http://scitools.org.uk/cartopy/docs/latest/)입니다. 나는 이것을 다음 날 며칠 안에 cartopy에서 똑같은 줄거리를 보여주는 예제를 게시 할 것이다. 이 문제는 고정되어 있습니다 : 당신이 실패의 간단한 예제를 포함 할 수 있다면
HTH
, 그때 우리는 간단한 솔루션 ... – pelson
참고로 올 수있는 (적어도 내 생각) 확신 basemap (1.0.8,)의 github 라이브러리이지만 현재 릴리즈 된 basemap (1.0.7) 버전에는 수정 사항이 포함되어 있지 않습니다. –