see http://janmatuschek.de/LatitudeLongitudeBoundingCoordinates
499097
public GeoRect getBoundingBox() {
        double radDist = radius / EARTH_RADIUS;
        double radLat = Math.toRadians(latitude);
        double radLon = Math.toRadians(longitude);

        double minLat = radLat - radDist;
        double maxLat = radLat + radDist;

        double minLon, maxLon;
        if (minLat > MIN_LAT && maxLat < MAX_LAT) {
            double deltaLon = Math.asin(Math.sin(radDist) /
                Math.cos(radLat));
            minLon = radLon - deltaLon;
            if (minLon < MIN_LON) {
                minLon += 2d * Math.PI;
            }
            maxLon = radLon + deltaLon;
            if (maxLon > MAX_LON) {
                maxLon -= 2d * Math.PI;
            }
        } else {
            // a pole is within the distance
            minLat = Math.max(minLat, MIN_LAT);
            maxLat = Math.min(maxLat, MAX_LAT);
            minLon = MIN_LON;
            maxLon = MAX_LON;
        }

        return new GeoRect(
            new GeoPoint(Math.toDegrees(maxLat), Math.toDegrees(minLon)),
            new GeoPoint(Math.toDegrees(minLat), Math.toDegrees(maxLon))
        );
    }
686570
def latitude(self, value):
        """"""
        self._latitude = math.radians(float(value))
        assert -self.PI / 2 <= self._latitude <= self.PI / 2, \
            "latitude value should be between -90..90."
903481
def latitude(self, latitude):
        """"""
        if not (-90 <= latitude <= 90):
            raise ValueError('latitude was {}, but has to be in [-90, 90]'
                             .format(latitude))
        self._latitude = latitude
1164072
private void findFullGridIntBounds() {
		int[] iIntBounds = getIntBounds(ibounds);

		bounds = new int[6];
		if (jbounds==null) {
			bounds = iIntBounds;
		} else {
			int[] jIntBounds = getIntBounds(jbounds);
			bounds[0] = Math.min(iIntBounds[0],jIntBounds[0]);
			bounds[1] = Math.min(iIntBounds[1],jIntBounds[1]);
			bounds[2] = Math.min(iIntBounds[2],jIntBounds[2]);
			bounds[3] = Math.max(iIntBounds[3],jIntBounds[3]);
			bounds[4] = Math.max(iIntBounds[4],jIntBounds[4]);
			bounds[5] = Math.max(iIntBounds[5],jIntBounds[5]);
		}
	}
251239
private static boolean betweenLongitudes(double topLeftLon, double bottomRightLon, double lon) {
        if (topLeftLon <= bottomRightLon)
            return lon >= topLeftLon && lon <= bottomRightLon;
        else
            return lon >= topLeftLon || lon <= bottomRightLon;
    }
437412
function GeoPoint(lat, lon, inRadians) {
    if (!isNumber(lat)) {
      throw new Error('Invalid latitude');
    }
    if (!isNumber(lon)) {
      throw new Error('Invalid longitude');
    }
    if (inRadians === true) {
      this._degLat = GeoPoint.radiansToDegrees(lat);
      this._degLon = GeoPoint.radiansToDegrees(lon);
      this._radLat = lat;
      this._radLon = lon;
    } else {
      this._degLat = lat;
      this._degLon = lon;
      this._radLat = GeoPoint.degreesToRadians(lat);
      this._radLon = GeoPoint.degreesToRadians(lon);
    }
    if (this._radLat < MIN_LAT || this._radLat > MAX_LAT) {
      throw new Error('Latitude out of bounds');
    } else if (this._radLon < MIN_LON || this._radLon > MAX_LON) {
      throw new Error('Longitude out of bounds');
    }
  }
1097608
def to_lat_lon
      k0 = 0.9996
      x  = @e - 500000 # Remove Longitude offset
      y  = @n

      # Set hemisphere (1=Northern, 0=Southern)
      y    -= 10000000.0 unless UTMZones::northern_hemisphere? @zone

      ecc = @ellipsoid.eccentricity
      eccPrimeSquared = (ecc)/(1-ecc)
      m  = y / k0
      mu = m / (@ellipsoid.radius * (1 - ecc / 4 - 3 * ecc ** 2 / 64 - 5 * ecc ** 3 / 256))
      e1 = (1 - Math::sqrt(1 - ecc)) / (1 + Math::sqrt(1 - ecc))
      phi1rad = mu +
        (3 * e1 / 2 - 27 * e1 ** 3 / 32) * Math::sin(2 * mu) +
        (21 * e1 ** 2 / 16 - 55 * e1 ** 4 / 32) * Math::sin(4 * mu) +
        (151 * e1 ** 3 / 96) * Math::sin(6 * mu)
      n1 = @ellipsoid.radius / Math::sqrt(1 - ecc * Math::sin(phi1rad) ** 2)
      t1 = Math::tan(phi1rad) ** 2
      c1 = ecc * Math::cos(phi1rad)**2
      r1 = @ellipsoid.radius * (1 - ecc) / ((1 - ecc * Math::sin(phi1rad) ** 2) ** 1.5)
      d = x / (n1 * k0)
      latitude_rad = phi1rad-
        (n1 * Math::tan(phi1rad) / r1) * (d * d / 2 - 
                                    (5 + 3 * t1 + 10 * c1 - 4 * c1 * c1 - 9 * eccPrimeSquared) * d ** 4 / 24 +
                                    (61 + 90 * t1 + 298 * c1 + 45 * t1 * t1 - 
                                     252 * eccPrimeSquared - 3 * c1 * c1) * d ** 6 / 720)
      latitude_deg = latitude_rad * 180.0 / Math::PI
      lon_tmp = (d - (1 + 2 * t1 + c1) * d ** 3 / 6 +
                   (5 - 2 * c1 + 28 * t1 - 3 * c1 * c1 + 8 * eccPrimeSquared +
                    24 * t1 * t1) * d ** 5 / 120) / Math::cos(phi1rad)
      longitude_deg = UTMZones::lon_origin(@zone) + lon_tmp * 180.0 / Math::PI
      LatLon.new latitude_deg, longitude_deg
    end
541197
public static function LL2Utm( string $ellipsoid, $lat, $long )
   {

      if ( ! isset( Ellipsoid::$Ellipsoid[ $ellipsoid ] ) )
      {
         // The defined ellipsoid does not exist.
         return false;
      }

      // Get the longitude decimal value
      $ln = ( ( $long instanceof AbstractElement )
         ? $long->getDecimalValue()
         : ( \is_double( $long ) ? $long : \doubleval( $long ) )
      );

      // Get the latitude decimal value
      $lt = ( ( $lat instanceof AbstractElement )
         ? $lat->getDecimalValue()
         : ( \is_double( $lat ) ? $lat : \doubleval( $lat ) )
      );

      // Init some required parameters
      $longOrigin      = null;
      $eccPrimeSquared = null;
      $longOriginRad   = null;
      $k0              = 0.9996;

      // Doing the calculation
      $a               = Ellipsoid::$Ellipsoid[ $ellipsoid ][ 0 ];
      $eccSquared      = Ellipsoid::$Ellipsoid[ $ellipsoid ][ 1 ];
      $N = null; $T = null; $C = null; $A = null; $M = null;
      $longTemp        = ( $ln + 180.0 ) - \intval( ( $ln + 180 ) / 360 ) * 360 - 180;
      $latRad          = $lt * self::DEG2RAD;
      $longRad         = $longTemp * self::DEG2RAD;
      $zoneNumber      = \intval( ( $longTemp + 180 ) / 6 ) + 1;

      if ( $lt >= 56.0 && $lt < 64.0 && $longTemp >= 3.0 && $longTemp < 12.0 )
      {
         $zoneNumber = 32;
      }

      if ( $lt >= 72.0 && $lt < 84.0 )
      {
         if ( $longTemp >= 0.0  && $longTemp <  9.0 )
         {
            $zoneNumber = 31;
         }
         else if ( $longTemp >= 9.0  && $longTemp < 22.0 )
         {
            $zoneNumber = 33;
         }
         else if ( $longTemp >= 22.0 && $longTemp < 33.0 )
         {
            $zoneNumber = 35;
         }
         else if ( $longTemp >= 33.0 && $longTemp < 42.0 )
         {
            $zoneNumber = 37;
         }
      }

      $longOrigin    = ( $zoneNumber - 1 ) * 6 - 180 + 3;
      $longOriginRad = $longOrigin * self::DEG2RAD;
      $UTMZone       = \sprintf(
         '%d%s',
         $zoneNumber,
         self::UTMLetterDesignator($lt)
      );

      $eccPrimeSquared = ( $eccSquared ) / ( 1 - $eccSquared );
      $N               = $a / \sqrt( 1 - $eccSquared * \sin( $latRad ) * \sin( $latRad ) );
      $T               = \tan( $latRad ) * \tan( $latRad );
      $C               = $eccPrimeSquared * \cos( $latRad ) * \cos( $latRad );
      $A               = \cos( $latRad ) * ( $longRad - $longOriginRad );
      $M               = $a * (
            ( 1 - $eccSquared/4 - 3 * $eccSquared * $eccSquared/64 - 5 * $eccSquared * $eccSquared * $eccSquared / 256 )
            * $latRad
            - (3 * $eccSquared/8 + 3 * $eccSquared * $eccSquared/32 + 45 * $eccSquared * $eccSquared * $eccSquared/1024)
              * \sin( 2 * $latRad )
            + ( 15 * $eccSquared * $eccSquared / 256 + 45 * $eccSquared * $eccSquared * $eccSquared / 1024 )
              * \sin( 4 * $latRad )
            - ( 35 * $eccSquared * $eccSquared * $eccSquared / 3072) * \sin( 6 * $latRad )
         );

      $UTMEasting = (double) ( $k0 * $N * ( $A + ( 1 - $T + $C ) * $A * $A * $A / 6
                                            + ( 5 - 18 * $T + $T * $T + 72 * $C - 58 * $eccPrimeSquared )
                                              * $A * $A * $A * $A * $A / 120 ) + 500000.0
      );
      $UTMEasting = \round( $UTMEasting, 0 );
      $UTMNorthing = (double) ( $k0
                                * ( $M + $N * \tan( $latRad ) * ( $A * $A / 2 + ( 5 - $T + 9 * $C + 4 * $C * $C )
                                                                                * $A * $A * $A * $A / 24 + ( 61 - 58 * $T + $T * $T + 600 * $C - 330 * $eccPrimeSquared )
                                                                                                           * $A * $A * $A * $A * $A * $A / 720 ) )
      );

      if ( $lt < 0 )
      {
         $UTMNorthing += 10000000.0;
      }

      $UTMNorthing = \round( $UTMNorthing, 0 );

      return "{$UTMZone} E {$UTMEasting} N {$UTMNorthing}";

   }
484383
public double getLongitudeSpan() {
        if (this.mapView.getWidth() > 0 && this.mapView.getHeight() > 0) {
            LatLong left = fromPixels(0, 0);
            LatLong right = fromPixels(this.mapView.getWidth(), 0);
            return Math.abs(left.longitude - right.longitude);
        }
        throw new IllegalStateException(INVALID_MAP_VIEW_DIMENSIONS);
    }
411880
public double[] getMapBounds() {
        BoundingBox bb = mapDataStore.boundingBox();
        double[] nswe = new double[4];
        nswe[0] = bb.maxLatitude;
        nswe[1] = bb.minLatitude;
        nswe[2] = bb.minLongitude;
        nswe[3] = bb.maxLongitude;
        return nswe;
    }
1138846
static double computeAngleBetween(IGeoPoint from, IGeoPoint to) {
        return distanceRadians(toRadians(from.getLatitude()), toRadians(from.getLongitude()),
            toRadians(to.getLatitude()), toRadians(to.getLongitude()));
    }
761019
function latitudeToPixel (latitude, zoom) {
  const latRad = toRadians(latitude)
  return (1 -
    Math.log(Math.tan(latRad) + (1 / Math.cos(latRad))) /
      Math.PI) / 2 * zScale(zoom)
}
1198247
def change_in_longitude(lat, miles):
    """"""

    # Find the radius of a circle around the earth at given latitude.
    r = earth_radius * math.cos(lat * degrees_to_radians)
    return (miles / r) * radians_to_degrees
14167
def _convert_latitude(self, latitude):
        """"""
        return int((180 - (180 / pi * log(tan(
            pi / 4 + latitude * pi / 360)))) * (2 ** self._zoom) * self._size / 360)
331629
function _calculateGridLatLonOffset(cellSize, latitude) {
  const yOffset = _calculateLatOffset(cellSize);
  const xOffset = _calculateLonOffset(latitude, cellSize);
  return {yOffset, xOffset};
}
279545
function (coords) {

		var map = this._map,
		    tileSize = this.getTileSize(),

		    nwPoint = coords.scaleBy(tileSize),
		    sePoint = nwPoint.add(tileSize),

		    nw = map.wrapLatLng(map.unproject(nwPoint, coords.z)),
		    se = map.wrapLatLng(map.unproject(sePoint, coords.z));

		return new L.LatLngBounds(nw, se);
	}
165675
private long[][] getLatitude( String lat ) {

        float secs = Float.parseFloat("0" + lat.substring(4)) * 60.f;
        long nom = (long) (secs * 1000);

        long[][] latl = new long[][]{{Long.parseLong(lat.substring(0, 2)), 1}, {Long.parseLong(lat.substring(2, 4)), 1},
                {nom, 1000}};

        return latl;
    }