MySQL Forums
Forum List  »  GIS

Finding places within a particular distance of a point using MySQL
Posted by: Mahesh M
Date: March 16, 2016 07:03AM

I'm working on a task as part of a project which finds the places within a certain distance of a particular (lat, long) point. I know the way to get the result for a single row in my table which has the (Latitude, Longitude) point and the corresponding distance (given by Coverage_Norm_10km, in my case).

My database table (Sorted_Range_Cap_Data) is of the following form:

Place , Population, Latitude, Longitude, Altitude, Bandwidth_Required, Coverage_Range, Throughput_Range, Coverage_Norm_10km, Throughput_10km

Place, (
6371 * acos (
cos ( radians(17.741150) )
* cos( radians(Latitude) )
* cos( radians(Longitude) - radians(73.149712) )
+ sin ( radians(17.741150) )
* sin( radians(Latitude) )
) AS Coverage_Norm_10km
FROM Sorted_Range_Cap_Data
HAVING Coverage_Norm_10km < (The current row's "Coverage_Norm_10km" value)
ORDER BY Coverage_Norm_10km
LIMIT 0, 20;
(Source :

Here, (17.741150, 73.149712) is a (lat, long) point in the first row of my database table. I want to find the set of all places which are within "Coverage_Norm_10km" distance from the (lat, long) point.

I need to repeat this for each row in the table.

Finally, I want to end up with the list of places for each (lat, long) point (every row) in my table.

Any help would be highly appreciated.

Options: ReplyQuote

Written By
Finding places within a particular distance of a point using MySQL
March 16, 2016 07:03AM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.