其实只要知道矩形的左上角经纬度和右下角经纬度即可。
如果有左上角的经纬度点(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
替换为实际的经纬度值。
这个查询考虑到了经度值增加时向右移动,纬度值增加时向上移动的地球坐标特点。