0

I already find this answer How to convert latitude or longitude to meters? and about haversine formula but it's written in javascript.

I want to know how can I give two coordinates like

48.829911, 2.373527
48.825843, 2.374273

and he will return for example there are 450 meters between them ? Do you have some function or library that I can use ? Thnks

  • According to my calculations, using `geographiclib`, the WGS84 distance between those two locations is 455.69153 metres. – PM 2Ring Aug 03 '18 at 12:58
  • I don't need the distance , it was an example, and I already had the distance with google maps feature. But I want to calculate it that with python not C++. – winston_smith Aug 03 '18 at 13:02
  • My code in the linked answer uses the WGS84 ellipsoid, rather than simple spherical trigonometry using haversine, so it's much more accurate. WGS84 is what the GPS system uses. – PM 2Ring Aug 03 '18 at 13:02
  • If you don't need the distance then why did you say that you want to calculate distance? But anyway, check out `geographiclib`, it is _very_ good. – PM 2Ring Aug 03 '18 at 13:05
  • Read it again, I said " Do you have some function or library that I can use " . You give me a library that I can use with c++ . Are you talking about this page https://geographiclib.sourceforge.io/html/python/ ? – winston_smith Aug 03 '18 at 13:17
  • Requests for libraries are off-topic on Stack Overflow. But yes, I recommend geographiclib, which is available in various languages. ;) And the question I linked shows how to use geographiclib from Python to compute distances between locations. Those docs in your last comment show you how to do a few other tasks as well. The full geographiclib can do even more, but sadly not all of its power is directly accessible from the Python package. – PM 2Ring Aug 03 '18 at 13:41

0 Answers0