public static function computeLength($path) {
        if (count($path) < 2) {
            return 0;
        }
        $length = 0;
        $prev = $path[0];
        $prevLat = deg2rad($prev['lat']);
        $prevLng = deg2rad($prev['lng']);
        foreach($path as $point) {
            $lat = deg2rad($point['lat']);
            $lng = deg2rad($point['lng']);
            $length += self::distanceRadians($prevLat, $prevLng, $lat, $lng);
            $prevLat = $lat;
            $prevLng = $lng;
        }
        return $length * MathUtil::EARTH_RADIUS;
    }
public static function computeLength($path) {
        if (count($path) < 2) {
            return 0;
        }
        $length = 0;
        $prev = $path[0];
        $prevLat = deg2rad($prev['lat']);
        $prevLng = deg2rad($prev['lng']);
        foreach($path as $point) {
            $lat = deg2rad($point['lat']);
            $lng = deg2rad($point['lng']);
            $length += self::distanceRadians($prevLat, $prevLng, $lat, $lng);
            $prevLat = $lat;
            $prevLng = $lng;
        }
        return $length * MathUtil::EARTH_RADIUS;
    }
public static function computeLength ( $ path ) { if ( count ( $ path ) < 2 ) { return 0 ; } $ length = 0 ; $ prev = $ path [ 0 ] ; $ prevLat = deg2rad ( $ prev [ 'lat' ] ) ; $ prevLng = deg2rad ( $ prev [ 'lng' ] ) ; foreach ( $ path as $ point ) { $ lat = deg2rad ( $ point [ 'lat' ] ) ; $ lng = deg2rad ( $ point [ 'lng' ] ) ; $ length += self :: distanceRadians ( $ prevLat , $ prevLng , $ lat , $ lng ) ; $ prevLat = $ lat ; $ prevLng = $ lng ; } return $ length * MathUtil :: EARTH_RADIUS ; }
Returns the length of the given path, in meters, on Earth.
Returns the length of the given path in meters on Earth .