函数
导入匹配
defcal_dis(latitude1,longitude1,latitude2,longitude2) :
latitude1=(math.pi/180 ) *latitude1
latitude2=(math.pi/180 ) *latitude2
longitude1=(math.pi/180 ) *longitude1
longitude2=(math.pi/180 ) *longitude2
#因此ab2点的球面距离为: { arccos [ sinb * siny cosb * cosy * cos (a-x ) ]}*R
#地球半径
全球r=6378.1;
d=math.ACOS(math.sin(latitude1) math.sin (latitude2) )
math.cos(latitude1) math.cos(latitude1) math.cos (longitude2- longitude1) ) r
返回d;
}
实现了根据输入的两点纬度和经度计算这两点距离的函数,但在实际操作中发生了错误:
以下是报告错误的数据集:
搜索相关报道的结果表明,原因是ACOS(x )的x越界。
语法
方法语法:
highlighter _ 972490 ' class=' syntaxhighlighterpy ' style=' width 3360651.11145019531 px; line-height :25.200007629395 px; Overflow :自动! 导入; '
nofollow ' class=' toolbar _ itemcommand _ help help ' style=' text-decoration : none; color : RGB (0,102,153 ); border:0px! 导入; line-height:1.1em! 导入; Overflow :可视! 导入; 文本对齐3360中心! 导入; 垂直对齐:基线! 导入; min-height :自动! 导入; 显示: block! 导入; 后台:无! 导入; '?
总结
如果你觉得编程家庭网站的内容很好,欢迎程序员朋友推荐程序员网站。
该文字内容由网民网络收集整理提供,作为学习参考,版权归原作者所有。
如果你喜欢交流学习经验,点击链接加入交流1群: 1065694478 (满)交流2群: 163560250