Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to calculate desired radius or distance with specific latitude and longitude in MYSQL with proper SQL standard?

Tags:

php

mysql

I need to know about how to calculate desired radius or distance with specific latitude and longitude in MYSQL with proper SQL standard? I have found many solutions on internet but they are taking to much time they have cos and other terms involved.please help!

like image 514
mudassar031 Avatar asked Jan 14 '13 10:01

mudassar031


People also ask

How do you find the distance between two points using latitude and longitude in SQL?

Heres is MySQL query and function which use to get distance between two latitude and longitude and distance will return in KM. SELECT getDistance($lat1,$lng1,$lat2,$lng2) as distance FROM your_table. Almost a decade later, this function gives THE SAME results as Google Maps distance measurement. Thank you!

How do you find the radius using latitude and longitude?

A circle of latitude at latitude lat=1.3963 rad has the radius Rs = R · cos(lat) = 1106 km, so d=1000 km now corresponds to an angular radius of rs = d/Rs = d/(R · cos(lat)) = 0.9039. Hence, covering d=1000 km on a circle of latitude gets you to longitude lonS = lon ± d/(R · cos(lat)) = -0.6981 rad ± 0.9039 rad.

How do I calculate the distance between two points specified by latitude and longitude?

For this divide the values of longitude and latitude of both the points by 180/pi. The value of pi is 22/7. The value of 180/pi is approximately 57.29577951. If we want to calculate the distance between two places in miles, use the value 3, 963, which is the radius of Earth.

How can I find the distance between two points in MySQL?

Calculating Distance in MySQL To get the distance between two points, you call the function with the two points as the arguments: -- Returns distance in meters.


1 Answers

Have a look this link.This may help you.

Calculate Distance.

like image 67
Muhammad Shoaib Avatar answered Sep 24 '22 14:09

Muhammad Shoaib