我试图弄清楚如何使用地理边界框的“左上纬度和经度”和“右下纬度和经度”从下面的 MySQL 表中检索信息。
CREATE TABLE `markers` (
`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`name` VARCHAR( 60 ) NOT NULL ,
`address` VARCHAR( 80 ) NOT NULL ,
`lat` decimal(10,7) NOT NULL ,
`long` decimal(10,7) NOT NULL,
`geopoint` point NOT NULL,
PRIMARY KEY (id),
SPATIAL geopoint (geopoint)
) ENGINE = MYISAM ;
到目前为止,我有下面的 SQL 查询,我不确定它是否是检索信息的最有效和最有效的方式?
$sql = "SELECT * FROM `markers` WHERE (long BETWEEN '$west_long' AND '$east_long') AND (lat BETWEEN '$north_lat' AND '$south_lat')";