Earth_Radius
Posted by Philip Leitch
Monday, March 08, 2010 10:33:00 PM
CREATE Function [dbo].[Earth_Radius](@Latitude numeric(9,6))
/*
www.prlsoftware.com
Author: Philip Leitch
Date: 2010
Purpose: This function determines the Earth's Radias at a specific latitude.
Copyright: Philip Leitch 2010
Licensing: This code may be used or modified but if the code is included in a software package attribution to me must be made.
Liability: The developer assumes all liability when using this code.
Notes:
*/
returns float
as
begin
declare @Return as float
Declare @a as float
declare @b as float
set @a = 6378.1370 --Equatorial radius
set @b = 6356.7523 --Polar radius
Declare @LatitudeRadians float
--Convet to radians
set @LatitudeRadians = @latitude * (pi()/180)
set @Return = sqrt(
(power(power(@a, 2)*Cos(@Latitude),2) + power(power(@b, 2)*sin(@Latitude),2))
/
(power(@a*Cos(@Latitude),2) + power(@b*sin(@Latitude),2))
)
return @Return
end
Copyright 2009 Philip Leitch