src/Geolite/Distance.php
public function flat()
    {
        Ellipsoid::checkCoordinatesEllipsoid($this->from, $this->to);

        $latA = deg2rad($this->from->getLatitude());
        $lngA = deg2rad($this->from->getLongitude());
        $latB = deg2rad($this->to->getLatitude());
        $lngB = deg2rad($this->to->getLongitude());

        $x = ($lngB - $lngA) * cos(($latA + $latB) / 2);
        $y = $latB - $latA;

        $sqrt = sqrt(($x * $x) + ($y * $y));

        return $this->convertToUserUnit($sqrt * $this->from->getEllipsoid()->getA());
    }
public function flat()
    {
        Ellipsoid::checkCoordinatesEllipsoid($this->from, $this->to);

        $latA = deg2rad($this->from->getLatitude());
        $lngA = deg2rad($this->from->getLongitude());
        $latB = deg2rad($this->to->getLatitude());
        $lngB = deg2rad($this->to->getLongitude());

        $x = ($lngB - $lngA) * cos(($latA + $latB) / 2);
        $y = $latB - $latA;

        $sqrt = sqrt(($x * $x) + ($y * $y));

        return $this->convertToUserUnit($sqrt * $this->from->getEllipsoid()->getA());
    }
Returns the approximate flat distance between two coordinates
using Pythagoras’ theorem which is not very accurate.
@see http://en.wikipedia.org/wiki/Pythagorean_theorem
@see http://en.wikipedia.org/wiki/Equirectangular_projection

@return double The distance in meters