I want to code some converter in C# (I need it for a project), where I get two (or more) coordinate pairs from QGIS, in decimal degree pair format (47.xxxx,19.xxxx). I need to measure the distance between two pairs, and return the result in Meters (with decimal). I am new to GIS, and so far I only figured out that 0.00012 is roughly 10 meters. But I want my program to be more precise than this.

How can this be calculated?

Does it have any formula?

I need an accuracy of at least 1/10th of a meter (but cm accuracy would be really nice).

  • 4
    Computing the distance between two lat/lon points on a spheroid is a partial differential equation only solvable through iterative means. It is the second of the two Problems of Geodesy, known as the Inverse (or Reverse) Problem. While it is possible to code your own, you'd save yourself a ton of debugging if you use a geodetic computation library.
    – Vince
    Dec 27, 2021 at 15:41
  • 1
    1 degree from East to West is rougly 110 km. At the Equator. At the Polar Circle that's only 36 km. So you figured wrong.
    – Erik
    Dec 27, 2021 at 16:19

2 Answers 2


Use Karney's GeographicLib see https://geographiclib.sourceforge.io/

  • Thank you for your suggestion, I looked at it it seems nice, but a bit overkill for my needs. I kept digging on MSDN and found this docs.microsoft.com/en-us/dotnet/api/… It's way not that complex, but for a simple distance calculation, it's good. It needs two decimal coordinates and returns the distance in meters. Just what I needed. Thank you very much! :)
    – Shapperd
    Dec 27, 2021 at 17:03


It's not as feature-packed as GeographicLib, but for simple distance calculation, it's more than enough.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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