Revision history [back]

All of the answers about converting LL to UTM are good but miss one tiny point that might be important. UTM coordinates are only continuous within a zone. If you cross a zone boundary the numbers reset. So a robot that is driving across a living room floor is not likely to cross a UTM zone boundary unless you are very unlucky but a self driving car might cross zone boundaries frequently. Each zone has its has its own coordinate system relative to the SW corner.

For larger distances the great circle is the way to go. It is simple enough that you can learn to estimate distances between two LL points in your head.

The other method, that pretty much simplifies calculations with LL is to convert LL to Cartesian. Define (0, 0, 0) as the center of the Earth.

A Great Circle is made by slicing the Earth in half, exactly in half, with a plane that is defined by three points, the center of the Earth and the pair of LL points in question. Now all your points are on a plane and we can use High School geometry to solve the problem

Define a circle with radius equal to the earth radius and center at the center of the earth (the equator is a good example of a great circle) Lets first assume your two LL points are on the equator. It is trivial to find their angular separation. It is the difference in longitude. What fraction of a circle is this angle? Multiply that fraction by the circumference of the equator. Use rounded values and this is easy to compute in your head.

What happens if the two points are NOT on the equator? Then imagine a new great circle centerd on the earth that passes through these points. It's circumference is the same as the equator (we assume a spherical Earth) Find the angular separation between these to points as viewed from the Earth's center. and continue as above.

How to find the angle? You solve a couple right triangle problems. A long time ago people where able to do this kind of work while on moving sailing ships by candlelight without a calculator. You need to know basic trig but not more

Yes you could simply use a library and that is what I did back when I worked on GIS systems but it is MUCH better if you understand what is going on.