Calculate distance between two coordinates

Instantly calculate the distance between two Addresses obtaining LAT and LNG from Google

The Calculator formula for Distance (in Miles):

(([field id=”lat_a“] == [field id=”lat_b“]) && ([field id=”lng_a“] == [field id=”lng_b“]) || !([field id=”lat_a“]) || !([field id=”lat_b“]) || !([field id=”lng_a“]) || !([field id=”lng_b“])) ? 0 : Math.acos( Math.sin(Math.PI * [field id=”lat_a“]/180) * Math.sin(Math.PI * [field id=”lat_b“]/180) + Math.cos(Math.PI * [field id=”lat_a“]/180) * Math.cos(Math.PI * [field id=”lat_b“]/180) * Math.cos(Math.PI * ([field id=”lng_a“] – [field id=”lng_b“])/180) ) * 180/Math.PI * 60 * 1.1515;

add an extra ” * 1.609344″ in the end to convert in KiloMeters
add and extra ” * 0.8684″ in the end to convert in Nautic Miles

Here the applied formula explained:
https://www.geodatasource.com/developers/javascript