Skip to content

Commit

Permalink
Add references for N and Lat -> North conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
ettersi committed Feb 7, 2024
1 parent efcef98 commit edf3394
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/MapMaths.jl
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ const b = a * (1-f)
const e2 = (2 - f) / inv_f

function N(lat)
# https://en.wikipedia.org/wiki/Earth_radius#Prime_vertical
s,c = sincosd(lat)
return a^2/sqrt((a*c)^2 + (b*s)^2)
end
Expand All @@ -275,6 +276,7 @@ _convert(::Type{East}, (lon,)::Lon, (lat,)::Lat) = π*ror_from_lat(lat)*lon / 18

function _convert(::Type{North}, (lat,)::Lat)
@assert abs(lat) <= 90
# https://en.wikipedia.org/wiki/Meridian_arc#Calculation
return a * (1-f)^2 * Elliptic.Pi(e2, lat*π/180, e2)
end

Expand Down

0 comments on commit edf3394

Please sign in to comment.