可以说我有两种坐标,第一种叫做 center_point
第二种叫做 test_point
。我想知道 test_point
坐标是否在 center_point
通过应用 radius
阈值。如果我写它,它就像:
center_point = [{'lat': -7.7940023, 'lng': 110.3656535}]
test_point = [{'lat': -7.79457, 'lng': 110.36563}]
radius = 5 # in kilometer
如何检查 test_point
center_point
的半径内还是半径外?我如何在 Python 中执行此类任务?
预期结果会说 test_point
在 --- 的内部或外部 radius
来自 center_point
坐标。
原文由 ytomo 发布,翻译遵循 CC BY-SA 4.0 许可协议
根据@user1753919 在他/她的评论中的推荐,我在这里得到了答案: Haversine Formula in Python (Bearing and Distance between two GPS points)
最终代码:
谢谢