pointToLineDistanceM static method
Calculates the perpendicular distance in meters from point p to line segment a, b.
Implementation
static double pointToLineDistanceM(LatLng p, LatLng a, LatLng b) {
LatLng nearest = nearestPointOnSegment(p, a, b);
return haversineDistance(p, nearest);
}