public static LatLonLocation ConvertToLatLonLocation(LocationBounded location)
 {
     return(new LatLonLocation
     {
         Latitude = location.getLatitudeInDegrees(),
         Longitude = location.getLongitudeInDegrees()
     });
 }
        /// <summary>
        /// Return GeoLocation from Radians
        /// </summary>
        /// <param name="latitude">The latitude, in radians.</param>
        /// <param name="longitude">The longitude, in radians.</param>
        /// <returns>GeoLocation in Radians</returns>
        public static LocationBounded FromRadians(double latitude, double longitude)
        {
            LocationBounded result = new LocationBounded
            {
                radLat = latitude,
                radLon = longitude,
                degLat = ConvertRadiansToDegrees(latitude),
                degLon = ConvertRadiansToDegrees(longitude)
            };

            result.CheckBounds();
            return(result);
        }
 /// <summary>
 /// Computes the great circle distance between this GeoLocation instance and the location argument.
 /// </summary>
 /// <param name="location">Location to act as the centre point</param>
 /// <returns>the distance, measured in the same unit as the radius argument.</returns>
 public double DistanceTo(LocationBounded location)
 {
     return(Math.Acos(Math.Sin(radLat) * Math.Sin(location.radLat) +
                      Math.Cos(radLat) * Math.Cos(location.radLat) *
                      Math.Cos(radLon - location.radLon)) * earthRadius);
 }