计算从经纬度到公里和英里的距离
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了计算从经纬度到公里和英里的距离相关的知识,希望对你有一定的参考价值。
Using SQL you can have your database return the distance between 2 sets of Lat and Long points, and using some math functions also take into account the curvature of the earth.
SELECT postcode, (3959*acos((sin(#latitude#/57.3) * sin(latitude/57.3))+ (cos(#latitude#/57.3) * cos(latitude/57.3) * cos((#longitude# - longitude)/57.3))))*8/5 AS exactDistance FROM postcode WHERE 1=1 ORDER BY (3959*acos((sin(#latitude#/57.3) * sin(latitude/57.3))+ (cos(#latitude#/57.3) * cos(latitude/57.3) * cos((#longitude# - longitude)/57.3))))*8/5
以上是关于计算从经纬度到公里和英里的距离的主要内容,如果未能解决你的问题,请参考以下文章