from math import radians, sin, cos, acos """ slat = Start Latitude slon = Start Longitude elat = End Latitude elon = End Longitude """ slon,slat = 16.596265846848024,62.811484968080336 elat,elon = 56.8734129,14.7967102 #Convert coordinates to radians elat2 = radians(float(elat)) slat2 = radians(float(slat)) elon2 = radians(float(elon)) slon2 = radians(float(slon)) #Calculate the distance between them dist = 6371.01 * acos(sin(slat2)*sin(elat2) + cos(slat2)*cos(elat2)*cos(slon2 - elon2)) print("The distance is %.2fkm." % dist)