您的位置:首页 > 数据库

sql经纬度查询

2017-04-08 14:38 106 查看
查询某一坐标附近1公里内的信息

select * from parking
where pa_examine=1 and pa_yes=1 and sqrt(
(
((#pa_longitude#-pa_longitude) * PI () * 12656 * cos
(((#pa_latitude# + pa_latitude)/2) * PI
()/180)/180)
*
((#pa_longitude#-pa_longitude) * PI () * 12656 * cos (((#pa_latitude#
+ pa_latitude)/2) * PI
()/180)/180)
)
+
(
((#pa_latitude# -pa_latitude)* PI
()* 12656/180)
*
((#pa_latitude# -pa_latitude)* PI ()* 12656/180)
)
)<=1

查询距离某一左边最近的20个信息

order by ACOS(SIN((#ho_longitude# * 3.1415) / 180 )
*SIN((ho_latitude * 3.1415) / 180 ) +COS((#ho_longitude# * 3.1415) / 180
) * COS((ho_latitude * 3.1415) / 180 ) *COS((#ho_latitude# * 3.1415) /
180 - (ho_longitude * 3.1415) / 180 ) ) * 6380 asc limit 20
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: