gis - Is there a method in Java for getting the circumference of a given latitude? -
the circumference of earth's latitudes vary per increase/decrease of latitude. searched around , found this page shows table of circumferences of earth on given latitude. there library or method can use on java?
it getcircumference(float latitude)
.
this function seems job:
public static double getcircumference(double lat) { double earthdiameter = 6378.137; double earthradiuspolar = 6356.752314; double c = math.cos((lat/180.0) * math.pi); c = c * earthdiameter; c = math.pow(c, 2); double s = math.sin((lat/180.0) * math.pi); s = s * earthradiuspolar; s = math.pow(s, 2); double res = math.pow(c + s, 0.5); res = math.pow(earthdiameter, 2) / res; return 2 * math.pi * math.cos((lat/180.0) * math.pi) * res; }
it's based on javascript on page , returns results on page linked to.
Comments
Post a Comment