Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have 2 points with their latitude/longitude coordinates and I know that they are in a X miles radius circle (let's say 10 miles radius) somewhere on earth where it's populated (I mean not near the north pole ;) ). I would like to know if these points are very very close of each other or not. When I say very very close, I mean a few meters (let's say 30 meters).

I don't want to use the heavy formula that returns the exact distance between 2 points anywhere on earth. I'm looking for a simplified formula that would simply answer yes or no to the previous question.

share|cite|improve this question
up vote 1 down vote accepted

The north/south distance is 1 nautical mile per minute of latitude. The east/west distance is $\cos \phi$ nautical mile per minute of longitude. So you have the total distance in nautical miles is $\sqrt{\Delta \phi^2+\cos^2 \phi \Delta \lambda}$ where the distance is in nautical miles and the angles are in minutes. Alternately, you can express it as $R\sqrt{\Delta \phi^2+\cos^2 \phi \Delta \lambda}, R$ the radius of the earth in your favorite units and angles in radians.

share|cite|improve this answer
My input is 2 points with their x/y. How do I use your formula with these? – Nicolas Cadilhac Oct 24 '11 at 18:11
At the start you said you had latitude and longitude. $\phi$ is latitude, $\lambda$ longitude. If you have $x$ and $y$, you can just use $\sqrt{x^2+y^2}$ – Ross Millikan Oct 24 '11 at 19:16
So I can see what $\Delta \phi^2$ is but what about $\phi$ alone in the Cos? Which of the 2 points is it? – Nicolas Cadilhac Oct 24 '11 at 19:42
If they are as close as you say, the latitudes are very similar. So use whichever you like, or the average. – Ross Millikan Oct 24 '11 at 19:44
If you want to know if they are within 30 meters$\approx$0.016 n mi, the latitudes will have to be within 0.016 minutes and the longitudes also within 0.016/$\cos \phi$ minutes. – Ross Millikan Oct 24 '11 at 19:47

You could approximate pretty easily by assuming that the surface of the earth is essentially flat within your region. Then, just use the basic euclidian metric (sticking with your longitude and latitude coordinates). i.e. if $$\sqrt{(x_1-y_1)^2+(x_2-y_2)^2}<d$$ for whatever distance $d$ then the points are within d of each other. The only cavet is that you'll require a relatively high degree of precision in your coordinates (though that's obvious if you want to measure distances in meteres). You'll over estimate a bit, but the error should be small as long as the points are close to each other.

share|cite|improve this answer
Given input in lat/long I guess I have a conversion to do to compare to d in meters? – Nicolas Cadilhac Oct 24 '11 at 18:12
Yes, but the scaling factor won't be constant as the distance per degree of longitude varies greatly. You could find the euclidian distance between two local points and compare against that. – Drew Christianson Oct 24 '11 at 18:42
Ultimately though, the formulas to calculate the precise distance (assuming a spherical earth) aren't too complex, what's your resistance to using them? – Drew Christianson Oct 24 '11 at 18:43
So, per your comment, I don't know how to achieve your solution... My resistance is about the number of calculation requests to a web server. Maybe it would be fine but I would prefer to compare the true formula with a simplified one in a benchmark. – Nicolas Cadilhac Oct 24 '11 at 19:43

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.