Skip to content

Commit 12822a9

Browse files
Fix demonimator typo
1 parent 68473af commit 12822a9

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

geodesy/lamberts_ellipsoidal_distance.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ def lamberts_ellipsoidal_distance(
8787
# Compute central angle between two points
8888
# using haversine theta. sigma = haversine_distance / equatorial radius
8989
sigma = haversine_distance(lat1, lon1, lat2, lon2) / EQUATORIAL_RADIUS
90+
9091

9192
# Intermediate P and Q values
9293
p_value = (b_lat1 + b_lat2) / 2
@@ -95,8 +96,8 @@ def lamberts_ellipsoidal_distance(
9596
# Intermediate X value
9697
# X = (sigma - sin(sigma)) * sin^2Pcos^2Q / cos^2(sigma/2)
9798
x_numerator = (sin(p_value) ** 2) * (cos(q_value) ** 2)
98-
x_demonimator = cos(sigma / 2) ** 2
99-
x_value = (sigma - sin(sigma)) * (x_numerator / x_demonimator)
99+
x_denominator = cos(sigma / 2) ** 2
100+
x_value = (sigma - sin(sigma)) * (x_numerator / x_denominator)
100101

101102
# Intermediate Y value
102103
# Y = (sigma + sin(sigma)) * cos^2Psin^2Q / sin^2(sigma/2)
@@ -106,6 +107,8 @@ def lamberts_ellipsoidal_distance(
106107

107108
return EQUATORIAL_RADIUS * (sigma - ((flattening / 2) * (x_value + y_value)))
108109

110+
print(f"SF-Yosemite: {lamberts_ellipsoidal_distance(37.774856, -122.424227, 37.864742, -119.537521):0,.0f}")
111+
print(f"Expected ~254km but got ???")
109112

110113
if __name__ == "__main__":
111114
import doctest

0 commit comments

Comments
 (0)