指定经纬度与数据库多条经纬度进行距离计算

##121.308364,30.225778 示例对比的坐标

select * from broadcasts where location!='' and sqrt(  
    (  
     ((121.308364-longitude)*PI()*12656*cos(((30.225778+latitude)/2)*PI()/180)/180)  
     *  
     ((121.308364-longitude)*PI()*12656*cos (((30.225778+latitude)/2)*PI()/180)/180)  
    )  
    +  
    (  
     ((30.225778-latitude)*PI()*12656/180)  
     *  
     ((30.225778-latitude)*PI()*12656/180)  
    )  
)<20

 

posted @ 2017-01-08 17:37  netcorner  阅读(1146)  评论(0编辑  收藏  举报