微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

根据矩形范围查询点位集合的sql语句

其实只要知道矩形的左上角经纬度和右下角经纬度即可。

如果有左上角的经纬度点(top_left_longitude, top_left_latitude)和右下角的经纬度点(bottom_right_longitude, bottom_right_latitude),那么查询语句如下:

SELECT * FROM your_table_name WHERE 经度 BETWEEN top_left_longitude AND bottom_right_longitude AND 纬度 BETWEEN bottom_right_latitude AND top_left_latitude;

请将:

  • your_table_name 替换为你的实际表名。
  • top_left_longitude, top_left_latitude, bottom_right_longitude, 和 bottom_right_latitude 替换为实际的经纬度值。

这个查询考虑到了经度值增加时向右移动,纬度值增加时向上移动的地球坐标特点。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐