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.
I know how to calculate this in cartesian coordinates but not on a sphere. Can somebody please provide the formula?
