0
$\begingroup$

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.

2 Answers 2

3

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.

  • 0
    My input is 2 points with their x/y. How do I use your formula with these?2011-10-24
  • 0
    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}$2011-10-24
  • 0
    So I can see what $\Delta \phi^2$ is but what about $\phi$ alone in the Cos? Which of the 2 points is it?2011-10-24
  • 1
    If they are as close as you say, the latitudes are very similar. So use whichever you like, or the average.2011-10-24
  • 1
    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.2011-10-24
  • 0
    Not ready in my code to test it yet, but I will surely use your formula. IF there is an issue I'll revisit this page.2011-11-01
1

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}

  • 0
    Given input in lat/long I guess I have a conversion to do to compare to d in meters?2011-10-24
  • 0
    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.2011-10-24
  • 0
    Ultimately though, the formulas to calculate the precise distance (assuming a spherical earth) aren't too complex, what's your resistance to using them?2011-10-24
  • 0
    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.2011-10-24