src/Lootils/Geo/Location.php
public function longitudeRange($distance) {
    $long = deg2rad($this->longitude());
    $lat = deg2rad($this->latitude());

    $radius = $this->earthRadius($this->latitude());
    $angle = $distance / $radius;
    $diff = asin(sin($angle) / cos($lat));

    $minlong = $long - $diff;
    if ($minlong < -pi()) {
      $minlong = $minlong + pi() * 2;
    }

    $maxlong = $long + $diff;
    if ($maxlong > pi()) {
      $maxlong = $maxlong - pi() * 2;
    }

    return array(
      'min' => rad2deg($minlong),
      'max' => rad2deg($maxlong),
    );
  }
public function longitudeRange($distance) {
    $long = deg2rad($this->longitude());
    $lat = deg2rad($this->latitude());

    $radius = $this->earthRadius($this->latitude());
    $angle = $distance / $radius;
    $diff = asin(sin($angle) / cos($lat));

    $minlong = $long - $diff;
    if ($minlong < -pi()) {
      $minlong = $minlong + pi() * 2;
    }

    $maxlong = $long + $diff;
    if ($maxlong > pi()) {
      $maxlong = $maxlong - pi() * 2;
    }

    return array(
      'min' => rad2deg($minlong),
      'max' => rad2deg($maxlong),
    );
  }
Find a range of longitude given a center point.

This is useful when you have a center point and want to find a range to
query against a set. For example, you want to find all the businesses to
display on the glowing rectangle (mobile device) given a center point and
radius.

Note, this are just quickly calculated estimates.

@param float $distance
The distance in meters from the center point to calculate.

@return array
An array with the two bounding values (floats) for the range.