0
点赞
收藏
分享

微信扫一扫

根据经纬度批量计算多个点到多个点之间的距离


def ad_dis(LatA,LonA,LatB,LonB):
# 批量计算多个点和多个点之间的球面距离
# LatA = np.array([23, 24])
# LatB = np.array([23, 24, 25])
# LonA = np.array([111, 112])
# LonB = np.array([111, 112, 113])
C = np.outer(np.sin(LatA), np.sin(LatB)) + np.outer(np.cos(LatA), np.cos(LatB)) * np.cos(
np.repeat(LonA.reshape(len(LonA), -1), len(LonB), -1) - np.repeat(LonB.reshape(-1, len(LonB)), len(LonA), 0))
Distance = 6370.856 * np.arccos(C) * np.pi / 180
return Distance



举报

相关推荐

0 条评论