`

mysql 三角测量计算地球表面两点之间的距离

阅读更多
SELECT (2*ATAN2(SQRT(SIN((-43.9043738--36.8750012)*PI()/180/2)
		*SIN((-43.9043738--36.8750012)*PI()/180/2)+
		COS(-36.8750012*PI()/180)*COS(-43.9043738*PI()/180)
		*SIN((171.7432229-174.7514922)*PI()/180/2)
		*SIN((171.7432229-174.7514922)*PI()/180/2)),
		SQRT(1-SIN((-43.9043738--36.8750012)*PI()/180/2)
		*SIN((-43.9043738--36.8750012)*PI()/180/2)
		+COS(-36.8750012*PI()/180)*COS(-43.9043738*PI()/180)
		*SIN((171.7432229-174.7514922)*PI()/180/2)
		*SIN((171.7432229-174.7514922)*PI()/180/2))))*6371 AS result


其中6371 为地球半径单位Km,公式很简单:



分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics