2

Let's say I have a set of points and I need to know which of them is the closest from some reference point. I also need to know the geodesic distance to it.

  • Can I first calculate Cartesian distances, since that is more efficient, and then when the closest point is found, finally calculate geodesic distance?
  • Would that always give me the same point as I would get if I calculated geodesic distances for all the points?

I found a similar question, but I doubt that answer is the same for all pairs of possible metrics.

1
  • 2
    No. In fact, in the context of geography, Cartesian metrics are 100% inaccurate compared to all geodetic metrics; however, you may find that, depending on the scale, the inaccuracy might get hidden away in precision. In other words, if your proximity search is on the neighborhood scale, Cartesian results will be accurate down to few cm - a level of precision unavailable to 99% of spatial data sources - and the margin of error neglectable.
    – geozelot
    Dec 8, 2022 at 10:41

1 Answer 1

2

No! And it's pretty easy to find counterexamples (where the cartesian distances are ranked opposite to the geodesic distances). For example, for the WGS84 ellipsoid, pick 3 points with positions

positions (latitude longitude in degrees).
  point0 = (-21,  0)
  point1 = ( 45, 27)
  point2 = (-32, 79)

geodesic distances to point0 (in meters)
  s01 = 7805205.225
  s02 = 7803524.684
  s02-s01 = -1680.541
i.e., point 2 is closer to point 0

cartesian distances to point0 (in meters)
  c01 = 7322504.559
  c02 = 7326441.695
  c02-c01 = 3937.136
i.e., point 1 is closer to point 0

This isn't a particularly common outcome. However, it certainly happens (with probability roughly 5/10000 for the WGS84 ellipsoid). And the discrepancy in the differences of the distances is reasonably large (on the order of kilometers).

ADDENDUM: If you have a single set of points and you want repeat the closest distance calcution for multiple reference points, put your point set (size N) into a vantage point tree. Then the cost of a single closest distance calculation is O(log(N)) instead of N.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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