It's not too crazy to find the closest records to a given longitude/latitude. Assuming you've a table location
with columns longitude
and latitude
you could do the following (substitute out the and with the values from your point.
SELECT id, latitude, longitude,
ROUND(6353 * 2 * ASIN(SQRT(POWER(SIN((<point_latitude> -
abs(latitude)) * pi()/180 / 2),2) + COS( <point_latitude> * pi()/180 )
* COS( abs(latitude) * pi()/180)
* POWER(SIN(( <point_longitude> - longitude)
* pi()/180 / 2), 2) )), 2) AS distance
FROM location
ORDER BY distance ASC
LIMIT 30;
You could do similar with spatial functions.