For a program I am writing I need to calculate the distances between coordinates. Seeing as I need to perform a large number of these calculations for each coordinate (thousands) it makes sense to convert to UTM, then calculate the distance (seeing as I am just comparing distances, I can even work with the square of the distance between the points).

At what point does this trade off make sense? As far as I can tell by reading the relevant calculations Greater Circle would be the faster algorithm, but obviously once you do the conversion to UTM you don't need to do it again. How many times do you need to run the Greater Circle algorithm before it makes sense to convert to UTM instead? (Assume that the accuracy isn't a big deal in my situation).

  • How accurate do the distances need to be and what's the longest distance you plan to calculate? Transverse Mercator isn't a particularly speedy algorithm itself.
    – mkennedy
    Commented Feb 11, 2019 at 4:03
  • small distances think in the 100m range. I thought Transverse Mercator would be the slower algorithm, the advantage would be that I only need to run it once per point instead of thousands of times with Greater Circle.
    – whossname
    Commented Feb 11, 2019 at 4:12
  • as far as accuracy is concerned so long as it is within say 10cm, I'm happy. Is accuracy a concern with either of these algorithms?
    – whossname
    Commented Feb 11, 2019 at 4:14
  • 2
    Have you considered doing performance tests for comparison? Commented Feb 11, 2019 at 4:37
  • 1
    Indeed, @KirkKuykendall has the right idea here. The best way to know how your data will perform on your hardware in two or three different algorithms is to perform a benchmark evaluation with a statistically significant sample of features.
    – Vince
    Commented Feb 11, 2019 at 11:19

1 Answer 1



IMHO, If your app were to run on a present-day server/desktop/notebook, be it real or virtual, any amount of effort you put into ramping up the computation throughput will far outweigh the return. Thousands of points or thousands of pairs of points are relatively small amounts. I would just use a library, e.g., the Karney formula/function in GeoPy.


For 10 cm error margin, I would turn to Vincenty or Karney. But since your distances are small (i.e., within 100 meters), I doubt this recommendation matters.


As JGH had correctly cautioned, if you go the convert-to-UTM-first route, all your points must be in the same UTM zone, or projected into the same Transverse Mercator grid/plane. And you need to be aware that a UTM Zone or a projected Transverse Mercator grid plane has its valid bounds.

  • 1) It's actually millions of points, it's just that I'm running an O(nlogn) algorithm so I only need to run it thousands of times per point. The previous thing I tried took 17 hours for 2 weeks of data. We have years of data to process.
    – whossname
    Commented Feb 12, 2019 at 12:12
  • 3) Don't worry, I'm on top of this part of it. I've done a fait bit of work with UTM in the past
    – whossname
    Commented Feb 12, 2019 at 12:14
  • 2) thanks for this, I'll check those out
    – whossname
    Commented Feb 12, 2019 at 12:14

Your Answer

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

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