Hello, I am trying so write a bit of code that will search for a given point on a map, but in a given arc of a compass bearing.
e.g. 45 degress (north-east), 20 degrees either side.
So far I have got a SQL command that will give me the results in a given radius, need some help on how to filter it to a direction.
SELECT * FROM (SELECT `place1_id`, `place2_id`, ( 6371 * acos( cos( radians(search_latitude) ) * cos( radians( `location_lat` ) ) * cos( radians( `location_long` ) - radians(search_longitude) ) + sin( radians(search_latitude) ) * sin( radians( `location_lat` ) ) ) ) AS `distance` FROM `place` ORDER BY distance) AS `places` WHERE `places`.`distance` < search_radius AND `places`.`place2_id` = ?
Will I be able to do this (if possible) all in SQL, or will it need a bit of PHP applying to it?
Any and all help much appreciated!