I am trying to figure out how retrieve the information from the MySQL table below using the "top-left latitude and longitude" and "bottom-right latitude and longitude" for a geographical bounding box.
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 ;
So far I have the SQL query below and I am not sure if it's the most effective and efficient way of retrieving the information?
$sql = "SELECT * FROM `markers` WHERE (long BETWEEN '$west_long' AND '$east_long') AND (lat BETWEEN '$north_lat' AND '$south_lat')";