public static function distance(Point $p1, Point $p2, $provider = "haversine")
    {
        switch ($provider){
            case "haversine":
                return self::haversineGreatCircleDistance($p1, $p2);

            case "vincenty":
                return self::vincentyGreatCircleDistance($p1, $p2);

            default:
                throw new GeoSpatialException('Great circle distance provider not found, providers available: ' . implode(", ", self::$greatCircleproviders));
        }
    }
public static function distance(Point $p1, Point $p2, $provider = "haversine")
    {
        switch ($provider){
            case "haversine":
                return self::haversineGreatCircleDistance($p1, $p2);

            case "vincenty":
                return self::vincentyGreatCircleDistance($p1, $p2);

            default:
                throw new GeoSpatialException('Great circle distance provider not found, providers available: ' . implode(", ", self::$greatCircleproviders));
        }
    }
public static function distance ( Point $ p1 , Point $ p2 , $ provider = "haversine" ) { switch ( $ provider ) { case "haversine" : return self :: haversineGreatCircleDistance ( $ p1 , $ p2 ) ; case "vincenty" : return self :: vincentyGreatCircleDistance ( $ p1 , $ p2 ) ; default : throw new GeoSpatialException ( 'Great circle distance provider not found, providers available: ' . implode ( ", " , self :: $ greatCircleproviders ) ) ; } }
Calculate the distance between two points in meter.

@param Point $p1
@param Point $p2
@param string $provider
@return float
@throws GeoSpatialException
Calculate the distance between two points in meter .