Point to great-circle segment distance (WGS84)

804 Views Asked by At

Disclaimer: This is a cross-post from stackoverflow -- the community recommended to post it here again


I want to calculate the distance from a point given by latitude and longitude to a line-segment given by two points (part of a great-circle). All coordinates are given in WGS84.

point-great-circle-arc-distance

I know how to calculate this in cartesian coordinates but not on a sphere. Can somebody please provide the formula?