Distance calculation: what algorithm/formula is used?

The Utility Functions : Distance Calculation is used to calculate the distance between 2 points (with lat/lng).
But it didn't use the Google Map API or tools like that, so which algorithm/formula is used to calculate the distance ? Vincenty ? Haversine ?

It has an important stake in precision, that’s why it interests me

Thanks in advance

Best Answer

  • arturosanz
    arturosanz Member ✭✭
    edited September 11 Answer ✓

    @Kat I guess Xano uses neither Haversine nor Vicenty, though it's very close to Haversine. Maybe Xano is using the Haversine formula but rounding off a few decimals at some point.

    It is easy to test by comparing the results with online calculators. For example, let's calculate the distance between the following two points.

    (48.857461 N, 2.291029 W) and (48.857461 N, 2.304698 W)

    Xano: 999.9595481786212

    Haversine: 1000

    Vicenty (GRS80 or WGS84): 1003.036

    Vicenty (ANS): 1003.04

    Vicenty (International 1924): 1003.084

    Here are the online calculators I have used:




  • Kat
    Kat Member
  • Ray Deck
    Ray Deck Trusted Xano Expert ✭✭✭

    hey Kat this is a xano product question and they are an American company on holiday for a long weekend (Labor Day). Be patient and they will get back to this in the coming week! I’m curious about the answer too!

  • Kat
    Kat Member
    edited September 10

    Hello Xano Team, do you have an answer to my question please :) ?

  • Kat
    Kat Member

    thanks @arturosanz

    Do you have an alternative to formulas.

    A free Google map distance calculation or something like this just to have more precision. I know mapbox api let you a large number of requests before paying.

    The difference between formula and api service is they do not take into account the roads, obstacle …

    I know there is more complexe formulas they took the rounding of the earth, … I’m just asking :&

  • arturosanz
    arturosanz Member ✭✭

    What is your use case in particular @Kat? What do you need the distance calculation for?

  • Hello @Kat

    You can have a FREE distance calculation between 2 points (with lat/lng) using here.com API

    They offer a number of free calls.

    We have already implemented the here.com API on Xano and created a snippet