Distance from Point To Line great circle function not working right.
I need to get the distance from a lat/lng point to a line. Of course needs to follow the Great Circle. I found a great article on this at http://www.movable-type.co.uk/scripts/latlong.html but the code is not working right. Either I am doing something wrong or there is something missing. Here is the function in question. See the link for the other functions if needed. var R = 3961.3 LatLon.crossTrack = function(lat1, lon1, lat2, lon2, lat3, lon3) { var d13 = LatLon.distHaversine(lat1, lon1, lat3, lon3); var brng12 = LatLon.bearing(lat1, lon1, lat2, lon2); var brng13 = LatLon.bearing(lat1, lon1