diff --git a/src/Cartography.jl b/src/Cartography.jl index d6d3469..5f69258 100644 --- a/src/Cartography.jl +++ b/src/Cartography.jl @@ -29,11 +29,14 @@ export Datum, NoDatum, WGS84, - WIII, + WGS84Latest, + ITRF, + ITRFLatest, ellipsoid, latitudeₒ, longitudeₒ, altitudeₒ, + epoch, # coordinates CRS, diff --git a/src/codes.jl b/src/codes.jl index e3226cc..1ec12e7 100644 --- a/src/codes.jl +++ b/src/codes.jl @@ -31,13 +31,13 @@ function crs end # IMPLEMENTATIONS # ---------------- -crs(::Type{EPSG{3395}}) = Mercator{WGS84} -crs(::Type{EPSG{3857}}) = WebMercator{WGS84} -crs(::Type{EPSG{4326}}) = LatLon{WGS84} -crs(::Type{EPSG{32662}}) = PlateCarree{WGS84} -crs(::Type{ESRI{54017}}) = Behrmann{WGS84} -crs(::Type{ESRI{54030}}) = Robinson{WGS84} -crs(::Type{ESRI{54034}}) = Lambert{WGS84} -crs(::Type{ESRI{54042}}) = WinkelTripel{WGS84} -crs(::Type{ESRI{102035}}) = Orthographic{90.0u"°",0.0u"°",true,WGS84} -crs(::Type{ESRI{102037}}) = Orthographic{-90.0u"°",0.0u"°",true,WGS84} +crs(::Type{EPSG{3395}}) = Mercator{WGS84Latest} +crs(::Type{EPSG{3857}}) = WebMercator{WGS84Latest} +crs(::Type{EPSG{4326}}) = LatLon{WGS84Latest} +crs(::Type{EPSG{32662}}) = PlateCarree{WGS84Latest} +crs(::Type{ESRI{54017}}) = Behrmann{WGS84Latest} +crs(::Type{ESRI{54030}}) = Robinson{WGS84Latest} +crs(::Type{ESRI{54034}}) = Lambert{WGS84Latest} +crs(::Type{ESRI{54042}}) = WinkelTripel{WGS84Latest} +crs(::Type{ESRI{102035}}) = Orthographic{90.0u"°",0.0u"°",true,WGS84Latest} +crs(::Type{ESRI{102037}}) = Orthographic{-90.0u"°",0.0u"°",true,WGS84Latest} diff --git a/src/crs/basic.jl b/src/crs/basic.jl index 2c1a6ae..46ecf00 100644 --- a/src/crs/basic.jl +++ b/src/crs/basic.jl @@ -23,7 +23,7 @@ The first 3 coordinates can be accessed with the properties `x`, `y` and `z`, re Cartesian(1, 1) # add default units Cartesian(1u"m", 1u"m") # integers are converted converted to floats Cartesian(1.0u"km", 1.0u"km", 1.0u"km") -Cartesian{WGS84}(1.0u"m", 1.0u"m") +Cartesian{WGS84Latest}(1.0u"m", 1.0u"m") ``` ## References @@ -110,7 +110,7 @@ Polar(1, π/4) # add default units Polar(1u"m", (π/4)u"rad") # integers are converted converted to floats Polar(1.0u"m", 45u"°") # degrees are converted to radians Polar(1.0u"km", (π/4)u"rad") -Polar{WGS84}(1.0u"m", (π/4)u"rad") +Polar{WGS84Latest}(1.0u"m", (π/4)u"rad") ``` ## References @@ -146,7 +146,7 @@ Cylindrical(1, π/4, 1) # add default units Cylindrical(1u"m", (π/4)u"rad", 1u"m") # integers are converted converted to floats Cylindrical(1.0u"m", 45u"°", 1.0u"m") # degrees are converted to radians Cylindrical(1.0u"km", (π/4)u"rad", 1.0u"km") -Cylindrical{WGS84}(1.0u"m", (π/4)u"rad", 1.0u"m") +Cylindrical{WGS84Latest}(1.0u"m", (π/4)u"rad", 1.0u"m") ``` ## References @@ -187,7 +187,7 @@ Spherical(1, π/4, π/4) # add default units Spherical(1u"m", (π/4)u"rad", (π/4)u"rad") # integers are converted converted to floats Spherical(1.0u"m", 45u"°", 45u"°") # degrees are converted to radians Spherical(1.0u"km", (π/4)u"rad", (π/4)u"rad") -Spherical{WGS84}(1.0u"m", (π/4)u"rad", (π/4)u"rad") +Spherical{WGS84Latest}(1.0u"m", (π/4)u"rad", (π/4)u"rad") ``` ## References diff --git a/src/crs/geographic.jl b/src/crs/geographic.jl index 2da99cc..0469e34 100644 --- a/src/crs/geographic.jl +++ b/src/crs/geographic.jl @@ -27,7 +27,7 @@ LatLon(45, 45) # add default units LatLon(45u"°", 45u"°") # integers are converted converted to floats LatLon((π/4)u"rad", (π/4)u"rad") # radians are converted to degrees LatLon(45.0u"°", 45.0u"°") -LatLon{WGS84}(45.0u"°", 45.0u"°") +LatLon{WGS84Latest}(45.0u"°", 45.0u"°") ``` See [EPSG:4326](https://epsg.io/4326). @@ -43,7 +43,7 @@ GeodeticLatLon{Datum}(lat::Rad, lon::Rad) where {Datum} = GeodeticLatLon{Datum}( GeodeticLatLon{Datum}(lat::Number, lon::Number) where {Datum} = GeodeticLatLon{Datum}(addunit(lat, u"°"), addunit(lon, u"°")) -GeodeticLatLon(args...) = GeodeticLatLon{WGS84}(args...) +GeodeticLatLon(args...) = GeodeticLatLon{WGS84Latest}(args...) const LatLon = GeodeticLatLon @@ -66,7 +66,7 @@ LatLonAlt(45u"°", 45u"°", 1u"m") # integers are converted converted to floats LatLonAlt((π/4)u"rad", (π/4)u"rad") # radians are converted to degrees LatLonAlt(45.0u"°", 45.0u"°", 1.0u"km") # length quantities are converted to meters LatLonAlt(45.0u"°", 45.0u"°", 1.0u"m") -LatLonAlt{WGS84}(45.0u"°", 45.0u"°", 1.0u"m") +LatLonAlt{WGS84Latest}(45.0u"°", 45.0u"°", 1.0u"m") ``` """ struct GeodeticLatLonAlt{Datum,D<:Deg,M<:Met} <: Geographic{Datum} @@ -86,7 +86,7 @@ GeodeticLatLonAlt{Datum}(lat::Rad, lon::Rad, alt::Len) where {Datum} = GeodeticLatLonAlt{Datum}(lat::Number, lon::Number, alt::Number) where {Datum} = GeodeticLatLonAlt{Datum}(addunit(lat, u"°"), addunit(lon, u"°"), addunit(alt, u"m")) -GeodeticLatLonAlt(args...) = GeodeticLatLonAlt{WGS84}(args...) +GeodeticLatLonAlt(args...) = GeodeticLatLonAlt{WGS84Latest}(args...) const LatLonAlt = GeodeticLatLonAlt @@ -104,7 +104,7 @@ GeocentricLatLon(45, 45) # add default units GeocentricLatLon(45u"°", 45u"°") # integers are converted converted to floats GeocentricLatLon((π/4)u"rad", (π/4)u"rad") # radians are converted to degrees GeocentricLatLon(45.0u"°", 45.0u"°") -GeocentricLatLon{WGS84}(45.0u"°", 45.0u"°") +GeocentricLatLon{WGS84Latest}(45.0u"°", 45.0u"°") ``` """ struct GeocentricLatLon{Datum,D<:Deg} <: Geographic{Datum} @@ -118,7 +118,7 @@ GeocentricLatLon{Datum}(lat::Rad, lon::Rad) where {Datum} = GeocentricLatLon{Dat GeocentricLatLon{Datum}(lat::Number, lon::Number) where {Datum} = GeocentricLatLon{Datum}(addunit(lat, u"°"), addunit(lon, u"°")) -GeocentricLatLon(args...) = GeocentricLatLon{WGS84}(args...) +GeocentricLatLon(args...) = GeocentricLatLon{WGS84Latest}(args...) """ AuthalicLatLon(lat, lon) @@ -134,7 +134,7 @@ AuthalicLatLon(45, 45) # add default units AuthalicLatLon(45u"°", 45u"°") # integers are converted converted to floats AuthalicLatLon((π/4)u"rad", (π/4)u"rad") # radians are converted to degrees AuthalicLatLon(45.0u"°", 45.0u"°") -AuthalicLatLon{WGS84}(45.0u"°", 45.0u"°") +AuthalicLatLon{WGS84Latest}(45.0u"°", 45.0u"°") ``` """ struct AuthalicLatLon{Datum,D<:Deg} <: Geographic{Datum} @@ -148,7 +148,7 @@ AuthalicLatLon{Datum}(lat::Rad, lon::Rad) where {Datum} = AuthalicLatLon{Datum}( AuthalicLatLon{Datum}(lat::Number, lon::Number) where {Datum} = AuthalicLatLon{Datum}(addunit(lat, u"°"), addunit(lon, u"°")) -AuthalicLatLon(args...) = AuthalicLatLon{WGS84}(args...) +AuthalicLatLon(args...) = AuthalicLatLon{WGS84Latest}(args...) # ------------ # CONVERSIONS diff --git a/src/crs/projected/eqareacylindrical.jl b/src/crs/projected/eqareacylindrical.jl index 83eb39d..cef7a1d 100644 --- a/src/crs/projected/eqareacylindrical.jl +++ b/src/crs/projected/eqareacylindrical.jl @@ -20,7 +20,7 @@ EqualAreaCylindrical{latₜₛ,Datum}(x::Len, y::Len) where {latₜₛ,Datum} = EqualAreaCylindrical{latₜₛ,Datum}(x::Number, y::Number) where {latₜₛ,Datum} = EqualAreaCylindrical{latₜₛ,Datum}(addunit(x, u"m"), addunit(y, u"m")) -EqualAreaCylindrical{latₜₛ}(args...) where {latₜₛ} = EqualAreaCylindrical{latₜₛ,WGS84}(args...) +EqualAreaCylindrical{latₜₛ}(args...) where {latₜₛ} = EqualAreaCylindrical{latₜₛ,WGS84Latest}(args...) """ Lambert(x, y) @@ -36,7 +36,7 @@ Lambert(1, 1) # add default units Lambert(1u"m", 1u"m") # integers are converted converted to floats Lambert(1.0u"km", 1.0u"km") # length quantities are converted to meters Lambert(1.0u"m", 1.0u"m") -Lambert{WGS84}(1.0u"m", 1.0u"m") +Lambert{WGS84Latest}(1.0u"m", 1.0u"m") ``` See [ESRI:54034](https://epsg.io/54034). @@ -57,7 +57,7 @@ Behrmann(1, 1) # add default units Behrmann(1u"m", 1u"m") # integers are converted converted to floats Behrmann(1.0u"km", 1.0u"km") # length quantities are converted to meters Behrmann(1.0u"m", 1.0u"m") -Behrmann{WGS84}(1.0u"m", 1.0u"m") +Behrmann{WGS84Latest}(1.0u"m", 1.0u"m") ``` See [ESRI:54017](https://epsg.io/54017). @@ -78,7 +78,7 @@ GallPeters(1, 1) # add default units GallPeters(1u"m", 1u"m") # integers are converted converted to floats GallPeters(1.0u"km", 1.0u"km") # length quantities are converted to meters GallPeters(1.0u"m", 1.0u"m") -GallPeters{WGS84}(1.0u"m", 1.0u"m") +GallPeters{WGS84Latest}(1.0u"m", 1.0u"m") ``` """ const GallPeters{Datum} = EqualAreaCylindrical{45.0u"°",Datum} diff --git a/src/crs/projected/eqdistcylindrical.jl b/src/crs/projected/eqdistcylindrical.jl index b96d315..e1b65be 100644 --- a/src/crs/projected/eqdistcylindrical.jl +++ b/src/crs/projected/eqdistcylindrical.jl @@ -20,7 +20,7 @@ EquidistantCylindrical{latₜₛ,Datum}(x::Len, y::Len) where {latₜₛ,Datum} EquidistantCylindrical{latₜₛ,Datum}(x::Number, y::Number) where {latₜₛ,Datum} = EquidistantCylindrical{latₜₛ,Datum}(addunit(x, u"m"), addunit(y, u"m")) -EquidistantCylindrical{latₜₛ}(args...) where {latₜₛ} = EquidistantCylindrical{latₜₛ,WGS84}(args...) +EquidistantCylindrical{latₜₛ}(args...) where {latₜₛ} = EquidistantCylindrical{latₜₛ,WGS84Latest}(args...) """ PlateCarree(x, y) @@ -36,7 +36,7 @@ PlateCarree(1, 1) # add default units PlateCarree(1u"m", 1u"m") # integers are converted converted to floats PlateCarree(1.0u"km", 1.0u"km") # length quantities are converted to meters PlateCarree(1.0u"m", 1.0u"m") -PlateCarree{WGS84}(1.0u"m", 1.0u"m") +PlateCarree{WGS84Latest}(1.0u"m", 1.0u"m") ``` See [EPSG:32662](https://epsg.io/32662). diff --git a/src/crs/projected/mercator.jl b/src/crs/projected/mercator.jl index c6ec92b..df047fc 100644 --- a/src/crs/projected/mercator.jl +++ b/src/crs/projected/mercator.jl @@ -16,7 +16,7 @@ Mercator(1, 1) # add default units Mercator(1u"m", 1u"m") # integers are converted converted to floats Mercator(1.0u"km", 1.0u"km") # length quantities are converted to meters Mercator(1.0u"m", 1.0u"m") -Mercator{WGS84}(1.0u"m", 1.0u"m") +Mercator{WGS84Latest}(1.0u"m", 1.0u"m") ``` See [EPSG:3395](https://epsg.io/3395). @@ -31,7 +31,7 @@ Mercator{Datum}(x::Met, y::Met) where {Datum} = Mercator{Datum}(promote(x, y)... Mercator{Datum}(x::Len, y::Len) where {Datum} = Mercator{Datum}(uconvert(u"m", x), uconvert(u"m", y)) Mercator{Datum}(x::Number, y::Number) where {Datum} = Mercator{Datum}(addunit(x, u"m"), addunit(y, u"m")) -Mercator(args...) = Mercator{WGS84}(args...) +Mercator(args...) = Mercator{WGS84Latest}(args...) # ------------ # CONVERSIONS diff --git a/src/crs/projected/orthographic.jl b/src/crs/projected/orthographic.jl index f59ceea..90438d3 100644 --- a/src/crs/projected/orthographic.jl +++ b/src/crs/projected/orthographic.jl @@ -21,7 +21,7 @@ Orthographic{lat₀,lon₀,S,Datum}(x::Len, y::Len) where {lat₀,lon₀,S,Datum Orthographic{lat₀,lon₀,S,Datum}(x::Number, y::Number) where {lat₀,lon₀,S,Datum} = Orthographic{lat₀,lon₀,S,Datum}(addunit(x, u"m"), addunit(y, u"m")) -Orthographic{lat₀,lon₀,S}(args...) where {lat₀,lon₀,S} = Orthographic{lat₀,lon₀,S,WGS84}(args...) +Orthographic{lat₀,lon₀,S}(args...) where {lat₀,lon₀,S} = Orthographic{lat₀,lon₀,S,WGS84Latest}(args...) """ OrthoNorth(x, y) @@ -37,7 +37,7 @@ OrthoNorth(1, 1) # add default units OrthoNorth(1u"m", 1u"m") # integers are converted converted to floats OrthoNorth(1.0u"km", 1.0u"km") # length quantities are converted to meters OrthoNorth(1.0u"m", 1.0u"m") -OrthoNorth{WGS84}(1.0u"m", 1.0u"m") +OrthoNorth{WGS84Latest}(1.0u"m", 1.0u"m") ``` """ const OrthoNorth{Datum} = Orthographic{90.0u"°",0.0u"°",false,Datum} @@ -56,7 +56,7 @@ OrthoSouth(1, 1) # add default units OrthoSouth(1u"m", 1u"m") # integers are converted converted to floats OrthoSouth(1.0u"km", 1.0u"km") # length quantities are converted to meters OrthoSouth(1.0u"m", 1.0u"m") -OrthoSouth{WGS84}(1.0u"m", 1.0u"m") +OrthoSouth{WGS84Latest}(1.0u"m", 1.0u"m") ``` """ const OrthoSouth{Datum} = Orthographic{-90.0u"°",0.0u"°",false,Datum} diff --git a/src/crs/projected/robinson.jl b/src/crs/projected/robinson.jl index 13e473c..b1d0ff2 100644 --- a/src/crs/projected/robinson.jl +++ b/src/crs/projected/robinson.jl @@ -16,7 +16,7 @@ Robinson(1, 1) # add default units Robinson(1u"m", 1u"m") # integers are converted converted to floats Robinson(1.0u"km", 1.0u"km") # length quantities are converted to meters Robinson(1.0u"m", 1.0u"m") -Robinson{WGS84}(1.0u"m", 1.0u"m") +Robinson{WGS84Latest}(1.0u"m", 1.0u"m") ``` See [ESRI:54030](https://epsg.io/54030). @@ -31,7 +31,7 @@ Robinson{Datum}(x::Met, y::Met) where {Datum} = Robinson{Datum}(promote(x, y)... Robinson{Datum}(x::Len, y::Len) where {Datum} = Robinson{Datum}(uconvert(u"m", x), uconvert(u"m", y)) Robinson{Datum}(x::Number, y::Number) where {Datum} = Robinson{Datum}(addunit(x, u"m"), addunit(y, u"m")) -Robinson(args...) = Robinson{WGS84}(args...) +Robinson(args...) = Robinson{WGS84Latest}(args...) # ------------ # CONVERSIONS diff --git a/src/crs/projected/webmercator.jl b/src/crs/projected/webmercator.jl index aa5c32e..68dee21 100644 --- a/src/crs/projected/webmercator.jl +++ b/src/crs/projected/webmercator.jl @@ -16,7 +16,7 @@ WebMercator(1, 1) # add default units WebMercator(1u"m", 1u"m") # integers are converted converted to floats WebMercator(1.0u"km", 1.0u"km") # length quantities are converted to meters WebMercator(1.0u"m", 1.0u"m") -WebMercator{WGS84}(1.0u"m", 1.0u"m") +WebMercator{WGS84Latest}(1.0u"m", 1.0u"m") ``` See [EPSG:3857](https://epsg.io/3857). @@ -31,7 +31,7 @@ WebMercator{Datum}(x::Met, y::Met) where {Datum} = WebMercator{Datum}(promote(x, WebMercator{Datum}(x::Len, y::Len) where {Datum} = WebMercator{Datum}(uconvert(u"m", x), uconvert(u"m", y)) WebMercator{Datum}(x::Number, y::Number) where {Datum} = WebMercator{Datum}(addunit(x, u"m"), addunit(y, u"m")) -WebMercator(args...) = WebMercator{WGS84}(args...) +WebMercator(args...) = WebMercator{WGS84Latest}(args...) # ------------ # CONVERSIONS diff --git a/src/crs/projected/winkeltripel.jl b/src/crs/projected/winkeltripel.jl index 9da9e46..f1e72c6 100644 --- a/src/crs/projected/winkeltripel.jl +++ b/src/crs/projected/winkeltripel.jl @@ -12,7 +12,7 @@ Winkel{lat₁,Datum}(x::Met, y::Met) where {lat₁,Datum} = Winkel{lat₁,Datum} Winkel{lat₁,Datum}(x::Len, y::Len) where {lat₁,Datum} = Winkel{lat₁,Datum}(uconvert(u"m", x), uconvert(u"m", y)) Winkel{lat₁,Datum}(x::Number, y::Number) where {lat₁,Datum} = Winkel{lat₁,Datum}(addunit(x, u"m"), addunit(y, u"m")) -Winkel{lat₁}(args...) where {lat₁} = Winkel{lat₁,WGS84}(args...) +Winkel{lat₁}(args...) where {lat₁} = Winkel{lat₁,WGS84Latest}(args...) """ WinkelTripel(x, y) @@ -28,7 +28,7 @@ WinkelTripel(1, 1) # add default units WinkelTripel(1u"m", 1u"m") # integers are converted converted to floats WinkelTripel(1.0u"km", 1.0u"km") # length quantities are converted to meters WinkelTripel(1.0u"m", 1.0u"m") -WinkelTripel{WGS84}(1.0u"m", 1.0u"m") +WinkelTripel{WGS84Latest}(1.0u"m", 1.0u"m") ``` See [ESRI:54042](https://epsg.io/54042). diff --git a/src/datums.jl b/src/datums.jl index 384a292..cae82f7 100644 --- a/src/datums.jl +++ b/src/datums.jl @@ -37,6 +37,13 @@ Returns the altitude origin of the datum type `D`. """ function altitudeₒ end +""" + epoch(D) + +Returns the reference epoch of the datum type `D`. +""" +function epoch end + """ NoDatum @@ -48,17 +55,63 @@ ellipsoid(::Type{NoDatum}) = nothing latitudeₒ(::Type{NoDatum}) = nothing longitudeₒ(::Type{NoDatum}) = nothing altitudeₒ(::Type{NoDatum}) = nothing +epoch(::Type{NoDatum}) = nothing """ - WGS84 + WGS84{GPSWeek} -WGS84 (World Geodetic System) datum. +WGS84 (World Geodetic System) datum with a given realization `GPSWeek` (default to 1762). +Currentry, WGS84 has six realizations in the following GPS weeks: +0, 730, 873, 1150, 1674 and 1762. -See [World Geodetic System](https://en.wikipedia.org/wiki/World_Geodetic_System) +`WGS84Latest` is an alias to `WGS84{2020}`. + +See [NGA - WORLD GEODETIC SYSTEM 1984](https://nsgreg.nga.mil/doc/view?i=4085) """ -abstract type WGS84 <: Datum end +abstract type WGS84{GPSWeek} <: Datum end + +const WGS84Latest = WGS84{1762} + +ellipsoid(::Type{<:WGS84}) = WGS84🌎 +latitudeₒ(::Type{<:WGS84}) = 0.0u"°" +longitudeₒ(::Type{<:WGS84}) = 0.0u"°" +altitudeₒ(::Type{<:WGS84}) = 0.0u"m" -ellipsoid(::Type{WGS84}) = WGS84🌎 -latitudeₒ(::Type{WGS84}) = 0.0u"°" -longitudeₒ(::Type{WGS84}) = 0.0u"°" -altitudeₒ(::Type{WGS84}) = 0.0u"m" +epoch(::Type{WGS84{0}}) = nothing +epoch(::Type{WGS84{730}}) = 1994.0 +epoch(::Type{WGS84{873}}) = 1997.0 +epoch(::Type{WGS84{1150}}) = 2001.0 +epoch(::Type{WGS84{1674}}) = 2005.0 +epoch(::Type{WGS84{1762}}) = 2005.0 + +""" + ITRF{Year} + +ITRF (International Terrestrial Reference Frame) datum with a given realization `Year` (default to 2020). +Currentry, ITRF has eleven realizations in the following years: +1991, 1992, 1993, 1994, 1996, 1997, 2000, 2005, 2008, 2014 and 2020. + +`ITRFLatest` is an alias to `ITRF{2020}`. + +See [The International Terrestrial Reference Frame (ITRF)](https://www.iers.org/IERS/EN/DataProducts/ITRF/itrf.html) +""" +abstract type ITRF{Year} end + +const ITRFLatest = ITRF{2020} + +ellipsoid(::Type{<:ITRF}) = GRS80🌎 +latitudeₒ(::Type{<:ITRF}) = 0.0u"°" +longitudeₒ(::Type{<:ITRF}) = 0.0u"°" +altitudeₒ(::Type{<:ITRF}) = 0.0u"m" + +epoch(::Type{ITRF{1991}}) = 1988.0 +epoch(::Type{ITRF{1992}}) = 1988.0 +epoch(::Type{ITRF{1993}}) = 1988.0 +epoch(::Type{ITRF{1994}}) = 1993.0 +epoch(::Type{ITRF{1996}}) = 1997.0 +epoch(::Type{ITRF{1997}}) = 1997.0 +epoch(::Type{ITRF{2000}}) = 1997.0 +epoch(::Type{ITRF{2005}}) = 2000.0 +epoch(::Type{ITRF{2008}}) = 2005.0 +epoch(::Type{ITRF{2014}}) = 2010.0 +epoch(::Type{ITRF{2020}}) = 2015.0 diff --git a/src/ellipsoids.jl b/src/ellipsoids.jl index 854d5e9..f2b2359 100644 --- a/src/ellipsoids.jl +++ b/src/ellipsoids.jl @@ -53,15 +53,7 @@ function flattening⁻¹ end abstract type WGS84🌎 <: RevolutionEllipsoid end -const _WGS84 = let - a = 6378137.0u"m" - f⁻¹ = 298.257223563 - f = inv(f⁻¹) - b = a * (1 - f) - e² = (2 - f) / f⁻¹ - e = √e² - (; a, b, e, e², f, f⁻¹) -end +const _WGS84 = ellipfromaf⁻¹(6378137.0u"m", 298.257223563) majoraxis(::Type{WGS84🌎}) = _WGS84.a minoraxis(::Type{WGS84🌎}) = _WGS84.b @@ -69,3 +61,14 @@ eccentricity(::Type{WGS84🌎}) = _WGS84.e eccentricity²(::Type{WGS84🌎}) = _WGS84.e² flattening(::Type{WGS84🌎}) = _WGS84.f flattening⁻¹(::Type{WGS84🌎}) = _WGS84.f⁻¹ + +abstract type GRS80🌎 <: RevolutionEllipsoid end + +const _GRS80 = ellipfromaf⁻¹(6378137.0u"m", 298.257222101) + +majoraxis(::Type{GRS80🌎}) = _GRS80.a +minoraxis(::Type{GRS80🌎}) = _GRS80.b +eccentricity(::Type{GRS80🌎}) = _GRS80.e +eccentricity²(::Type{GRS80🌎}) = _GRS80.e² +flattening(::Type{GRS80🌎}) = _GRS80.f +flattening⁻¹(::Type{GRS80🌎}) = _GRS80.f⁻¹ diff --git a/src/utils.jl b/src/utils.jl index 79a4269..7ee1b6e 100644 --- a/src/utils.jl +++ b/src/utils.jl @@ -100,3 +100,17 @@ function projinv(fx, fy, x, y, λₒ, ϕₒ; maxiter=10, tol=atol(x)) λᵢ₊₁, ϕᵢ₊₁ end + +""" + ellipfromaf⁻¹(a, f⁻¹) + +Calculates the parameters of the ellipsoid with a given +major axis `a` and flattening inverse `f⁻¹`. +""" +function ellipfromaf⁻¹(a, f⁻¹) + f = inv(f⁻¹) + b = a * (1 - f) + e² = (2 - f) / f⁻¹ + e = √e² + (; a, b, e, e², f, f⁻¹) +end diff --git a/test/codes.jl b/test/codes.jl index 87c5d46..554c9c7 100644 --- a/test/codes.jl +++ b/test/codes.jl @@ -1,12 +1,12 @@ @testset "EPSG/ESRI Codes" begin - @test Cartography.crs(EPSG{3395}) === Mercator{WGS84} - @test Cartography.crs(EPSG{3857}) === WebMercator{WGS84} - @test Cartography.crs(EPSG{4326}) === LatLon{WGS84} - @test Cartography.crs(EPSG{32662}) === PlateCarree{WGS84} - @test Cartography.crs(ESRI{54017}) === Behrmann{WGS84} - @test Cartography.crs(ESRI{54030}) === Robinson{WGS84} - @test Cartography.crs(ESRI{54034}) === Lambert{WGS84} - @test Cartography.crs(ESRI{54042}) === WinkelTripel{WGS84} - @test Cartography.crs(ESRI{102035}) === Cartography.Orthographic{90.0u"°",0.0u"°",true,WGS84} - @test Cartography.crs(ESRI{102037}) === Cartography.Orthographic{-90.0u"°",0.0u"°",true,WGS84} + @test Cartography.crs(EPSG{3395}) === Mercator{WGS84Latest} + @test Cartography.crs(EPSG{3857}) === WebMercator{WGS84Latest} + @test Cartography.crs(EPSG{4326}) === LatLon{WGS84Latest} + @test Cartography.crs(EPSG{32662}) === PlateCarree{WGS84Latest} + @test Cartography.crs(ESRI{54017}) === Behrmann{WGS84Latest} + @test Cartography.crs(ESRI{54030}) === Robinson{WGS84Latest} + @test Cartography.crs(ESRI{54034}) === Lambert{WGS84Latest} + @test Cartography.crs(ESRI{54042}) === WinkelTripel{WGS84Latest} + @test Cartography.crs(ESRI{102035}) === Cartography.Orthographic{90.0u"°",0.0u"°",true,WGS84Latest} + @test Cartography.crs(ESRI{102037}) === Cartography.Orthographic{-90.0u"°",0.0u"°",true,WGS84Latest} end diff --git a/test/crs.jl b/test/crs.jl index 37e365e..917cd40 100644 --- a/test/crs.jl +++ b/test/crs.jl @@ -7,10 +7,10 @@ @test isnothing(altitudeₒ(c)) c = LatLon(T(1), T(1)) - @test datum(c) === WGS84 - @test latitudeₒ(c) == latitudeₒ(WGS84) - @test longitudeₒ(c) == longitudeₒ(WGS84) - @test altitudeₒ(c) == altitudeₒ(WGS84) + @test datum(c) === WGS84Latest + @test latitudeₒ(c) == latitudeₒ(WGS84Latest) + @test longitudeₒ(c) == longitudeₒ(WGS84Latest) + @test altitudeₒ(c) == altitudeₒ(WGS84Latest) end @testset "Cartesian" begin @@ -176,15 +176,15 @@ @test LatLon(T(π / 4) * u"rad", T(π / 4) * u"rad") ≈ LatLon(T(45) * u"°", T(45) * u"°") c = LatLon(T(1), T(1)) - @test sprint(show, c) == "GeodeticLatLon{WGS84}(lat: 1.0°, lon: 1.0°)" + @test sprint(show, c) == "GeodeticLatLon{WGS84Latest}(lat: 1.0°, lon: 1.0°)" if T === Float32 @test sprint(show, MIME("text/plain"), c) == """ - GeodeticLatLon{WGS84} coordinates + GeodeticLatLon{WGS84Latest} coordinates ├─ lat: 1.0f0° └─ lon: 1.0f0°""" else @test sprint(show, MIME("text/plain"), c) == """ - GeodeticLatLon{WGS84} coordinates + GeodeticLatLon{WGS84Latest} coordinates ├─ lat: 1.0° └─ lon: 1.0°""" end @@ -203,16 +203,16 @@ LatLonAlt(T(45) * u"°", T(45) * u"°", T(1000) * u"m") c = LatLonAlt(T(1), T(1), T(1)) - @test sprint(show, c) == "GeodeticLatLonAlt{WGS84}(lat: 1.0°, lon: 1.0°, alt: 1.0 m)" + @test sprint(show, c) == "GeodeticLatLonAlt{WGS84Latest}(lat: 1.0°, lon: 1.0°, alt: 1.0 m)" if T === Float32 @test sprint(show, MIME("text/plain"), c) == """ - GeodeticLatLonAlt{WGS84} coordinates + GeodeticLatLonAlt{WGS84Latest} coordinates ├─ lat: 1.0f0° ├─ lon: 1.0f0° └─ alt: 1.0f0 m""" else @test sprint(show, MIME("text/plain"), c) == """ - GeodeticLatLonAlt{WGS84} coordinates + GeodeticLatLonAlt{WGS84Latest} coordinates ├─ lat: 1.0° ├─ lon: 1.0° └─ alt: 1.0 m""" @@ -232,15 +232,15 @@ @test GeocentricLatLon(T(π / 4) * u"rad", T(π / 4) * u"rad") ≈ GeocentricLatLon(T(45) * u"°", T(45) * u"°") c = GeocentricLatLon(T(1), T(1)) - @test sprint(show, c) == "GeocentricLatLon{WGS84}(lat: 1.0°, lon: 1.0°)" + @test sprint(show, c) == "GeocentricLatLon{WGS84Latest}(lat: 1.0°, lon: 1.0°)" if T === Float32 @test sprint(show, MIME("text/plain"), c) == """ - GeocentricLatLon{WGS84} coordinates + GeocentricLatLon{WGS84Latest} coordinates ├─ lat: 1.0f0° └─ lon: 1.0f0°""" else @test sprint(show, MIME("text/plain"), c) == """ - GeocentricLatLon{WGS84} coordinates + GeocentricLatLon{WGS84Latest} coordinates ├─ lat: 1.0° └─ lon: 1.0°""" end @@ -258,15 +258,15 @@ @test Mercator(T(1) * u"km", T(1) * u"km") == Mercator(T(1000) * u"m", T(1000) * u"m") c = Mercator(T(1), T(1)) - @test sprint(show, c) == "Mercator{WGS84}(x: 1.0 m, y: 1.0 m)" + @test sprint(show, c) == "Mercator{WGS84Latest}(x: 1.0 m, y: 1.0 m)" if T === Float32 @test sprint(show, MIME("text/plain"), c) == """ - Mercator{WGS84} coordinates + Mercator{WGS84Latest} coordinates ├─ x: 1.0f0 m └─ y: 1.0f0 m""" else @test sprint(show, MIME("text/plain"), c) == """ - Mercator{WGS84} coordinates + Mercator{WGS84Latest} coordinates ├─ x: 1.0 m └─ y: 1.0 m""" end @@ -284,15 +284,15 @@ @test WebMercator(T(1) * u"km", T(1) * u"km") == WebMercator(T(1000) * u"m", T(1000) * u"m") c = WebMercator(T(1), T(1)) - @test sprint(show, c) == "WebMercator{WGS84}(x: 1.0 m, y: 1.0 m)" + @test sprint(show, c) == "WebMercator{WGS84Latest}(x: 1.0 m, y: 1.0 m)" if T === Float32 @test sprint(show, MIME("text/plain"), c) == """ - WebMercator{WGS84} coordinates + WebMercator{WGS84Latest} coordinates ├─ x: 1.0f0 m └─ y: 1.0f0 m""" else @test sprint(show, MIME("text/plain"), c) == """ - WebMercator{WGS84} coordinates + WebMercator{WGS84Latest} coordinates ├─ x: 1.0 m └─ y: 1.0 m""" end @@ -310,15 +310,15 @@ @test PlateCarree(T(1) * u"km", T(1) * u"km") == PlateCarree(T(1000) * u"m", T(1000) * u"m") c = PlateCarree(T(1), T(1)) - @test sprint(show, c) == "PlateCarree{WGS84}(x: 1.0 m, y: 1.0 m)" + @test sprint(show, c) == "PlateCarree{WGS84Latest}(x: 1.0 m, y: 1.0 m)" if T === Float32 @test sprint(show, MIME("text/plain"), c) == """ - PlateCarree{WGS84} coordinates + PlateCarree{WGS84Latest} coordinates ├─ x: 1.0f0 m └─ y: 1.0f0 m""" else @test sprint(show, MIME("text/plain"), c) == """ - PlateCarree{WGS84} coordinates + PlateCarree{WGS84Latest} coordinates ├─ x: 1.0 m └─ y: 1.0 m""" end @@ -336,15 +336,15 @@ @test Lambert(T(1) * u"km", T(1) * u"km") == Lambert(T(1000) * u"m", T(1000) * u"m") c = Lambert(T(1), T(1)) - @test sprint(show, c) == "Lambert{WGS84}(x: 1.0 m, y: 1.0 m)" + @test sprint(show, c) == "Lambert{WGS84Latest}(x: 1.0 m, y: 1.0 m)" if T === Float32 @test sprint(show, MIME("text/plain"), c) == """ - Lambert{WGS84} coordinates + Lambert{WGS84Latest} coordinates ├─ x: 1.0f0 m └─ y: 1.0f0 m""" else @test sprint(show, MIME("text/plain"), c) == """ - Lambert{WGS84} coordinates + Lambert{WGS84Latest} coordinates ├─ x: 1.0 m └─ y: 1.0 m""" end @@ -362,15 +362,15 @@ @test Behrmann(T(1) * u"km", T(1) * u"km") == Behrmann(T(1000) * u"m", T(1000) * u"m") c = Behrmann(T(1), T(1)) - @test sprint(show, c) == "Behrmann{WGS84}(x: 1.0 m, y: 1.0 m)" + @test sprint(show, c) == "Behrmann{WGS84Latest}(x: 1.0 m, y: 1.0 m)" if T === Float32 @test sprint(show, MIME("text/plain"), c) == """ - Behrmann{WGS84} coordinates + Behrmann{WGS84Latest} coordinates ├─ x: 1.0f0 m └─ y: 1.0f0 m""" else @test sprint(show, MIME("text/plain"), c) == """ - Behrmann{WGS84} coordinates + Behrmann{WGS84Latest} coordinates ├─ x: 1.0 m └─ y: 1.0 m""" end @@ -388,15 +388,15 @@ @test GallPeters(T(1) * u"km", T(1) * u"km") == GallPeters(T(1000) * u"m", T(1000) * u"m") c = GallPeters(T(1), T(1)) - @test sprint(show, c) == "GallPeters{WGS84}(x: 1.0 m, y: 1.0 m)" + @test sprint(show, c) == "GallPeters{WGS84Latest}(x: 1.0 m, y: 1.0 m)" if T === Float32 @test sprint(show, MIME("text/plain"), c) == """ - GallPeters{WGS84} coordinates + GallPeters{WGS84Latest} coordinates ├─ x: 1.0f0 m └─ y: 1.0f0 m""" else @test sprint(show, MIME("text/plain"), c) == """ - GallPeters{WGS84} coordinates + GallPeters{WGS84Latest} coordinates ├─ x: 1.0 m └─ y: 1.0 m""" end @@ -414,15 +414,15 @@ @test WinkelTripel(T(1) * u"km", T(1) * u"km") == WinkelTripel(T(1000) * u"m", T(1000) * u"m") c = WinkelTripel(T(1), T(1)) - @test sprint(show, c) == "WinkelTripel{WGS84}(x: 1.0 m, y: 1.0 m)" + @test sprint(show, c) == "WinkelTripel{WGS84Latest}(x: 1.0 m, y: 1.0 m)" if T === Float32 @test sprint(show, MIME("text/plain"), c) == """ - WinkelTripel{WGS84} coordinates + WinkelTripel{WGS84Latest} coordinates ├─ x: 1.0f0 m └─ y: 1.0f0 m""" else @test sprint(show, MIME("text/plain"), c) == """ - WinkelTripel{WGS84} coordinates + WinkelTripel{WGS84Latest} coordinates ├─ x: 1.0 m └─ y: 1.0 m""" end @@ -440,15 +440,15 @@ @test Robinson(T(1) * u"km", T(1) * u"km") == Robinson(T(1000) * u"m", T(1000) * u"m") c = Robinson(T(1), T(1)) - @test sprint(show, c) == "Robinson{WGS84}(x: 1.0 m, y: 1.0 m)" + @test sprint(show, c) == "Robinson{WGS84Latest}(x: 1.0 m, y: 1.0 m)" if T === Float32 @test sprint(show, MIME("text/plain"), c) == """ - Robinson{WGS84} coordinates + Robinson{WGS84Latest} coordinates ├─ x: 1.0f0 m └─ y: 1.0f0 m""" else @test sprint(show, MIME("text/plain"), c) == """ - Robinson{WGS84} coordinates + Robinson{WGS84Latest} coordinates ├─ x: 1.0 m └─ y: 1.0 m""" end @@ -466,15 +466,15 @@ @test OrthoNorth(T(1) * u"km", T(1) * u"km") == OrthoNorth(T(1000) * u"m", T(1000) * u"m") c = OrthoNorth(T(1), T(1)) - @test sprint(show, c) == "OrthoNorth{WGS84}(x: 1.0 m, y: 1.0 m)" + @test sprint(show, c) == "OrthoNorth{WGS84Latest}(x: 1.0 m, y: 1.0 m)" if T === Float32 @test sprint(show, MIME("text/plain"), c) == """ - OrthoNorth{WGS84} coordinates + OrthoNorth{WGS84Latest} coordinates ├─ x: 1.0f0 m └─ y: 1.0f0 m""" else @test sprint(show, MIME("text/plain"), c) == """ - OrthoNorth{WGS84} coordinates + OrthoNorth{WGS84Latest} coordinates ├─ x: 1.0 m └─ y: 1.0 m""" end @@ -492,15 +492,15 @@ @test OrthoSouth(T(1) * u"km", T(1) * u"km") == OrthoSouth(T(1000) * u"m", T(1000) * u"m") c = OrthoSouth(T(1), T(1)) - @test sprint(show, c) == "OrthoSouth{WGS84}(x: 1.0 m, y: 1.0 m)" + @test sprint(show, c) == "OrthoSouth{WGS84Latest}(x: 1.0 m, y: 1.0 m)" if T === Float32 @test sprint(show, MIME("text/plain"), c) == """ - OrthoSouth{WGS84} coordinates + OrthoSouth{WGS84Latest} coordinates ├─ x: 1.0f0 m └─ y: 1.0f0 m""" else @test sprint(show, MIME("text/plain"), c) == """ - OrthoSouth{WGS84} coordinates + OrthoSouth{WGS84Latest} coordinates ├─ x: 1.0 m └─ y: 1.0 m""" end @@ -684,483 +684,483 @@ @testset "GeodeticLatLon <> GeocentricLatLon" begin c1 = LatLon(T(30), T(40)) - c2 = convert(GeocentricLatLon{WGS84}, c1) + c2 = convert(GeocentricLatLon{WGS84Latest}, c1) @test c2 ≈ GeocentricLatLon(T(29.833635809829065), T(40)) - c3 = convert(LatLon{WGS84}, c2) + c3 = convert(LatLon{WGS84Latest}, c2) @test c3 ≈ c1 c1 = LatLon(T(35), T(40)) - c2 = convert(GeocentricLatLon{WGS84}, c1) + c2 = convert(GeocentricLatLon{WGS84Latest}, c1) @test c2 ≈ GeocentricLatLon(T(34.819388702349606), T(40)) - c3 = convert(LatLon{WGS84}, c2) + c3 = convert(LatLon{WGS84Latest}, c2) @test c3 ≈ c1 c1 = LatLon(T(40), T(40)) - c2 = convert(GeocentricLatLon{WGS84}, c1) + c2 = convert(GeocentricLatLon{WGS84Latest}, c1) @test c2 ≈ GeocentricLatLon(T(39.810610551928434), T(40)) - c3 = convert(LatLon{WGS84}, c2) + c3 = convert(LatLon{WGS84Latest}, c2) @test c3 ≈ c1 c1 = LatLon(-T(30), T(40)) - c2 = convert(GeocentricLatLon{WGS84}, c1) + c2 = convert(GeocentricLatLon{WGS84Latest}, c1) @test c2 ≈ GeocentricLatLon(-T(29.833635809829065), T(40)) - c3 = convert(LatLon{WGS84}, c2) + c3 = convert(LatLon{WGS84Latest}, c2) @test c3 ≈ c1 c1 = LatLon(-T(35), T(40)) - c2 = convert(GeocentricLatLon{WGS84}, c1) + c2 = convert(GeocentricLatLon{WGS84Latest}, c1) @test c2 ≈ GeocentricLatLon(-T(34.819388702349606), T(40)) - c3 = convert(LatLon{WGS84}, c2) + c3 = convert(LatLon{WGS84Latest}, c2) @test c3 ≈ c1 c1 = LatLon(-T(40), T(40)) - c2 = convert(GeocentricLatLon{WGS84}, c1) + c2 = convert(GeocentricLatLon{WGS84Latest}, c1) @test c2 ≈ GeocentricLatLon(-T(39.810610551928434), T(40)) - c3 = convert(LatLon{WGS84}, c2) + c3 = convert(LatLon{WGS84Latest}, c2) @test c3 ≈ c1 # type stability c1 = LatLon(T(30), T(40)) c2 = GeocentricLatLon(T(29.833635809829065), T(40)) - @inferred convert(GeocentricLatLon{WGS84}, c1) - @inferred convert(LatLon{WGS84}, c2) + @inferred convert(GeocentricLatLon{WGS84Latest}, c1) + @inferred convert(LatLon{WGS84Latest}, c2) end @testset "GeodeticLatLon <> AuthalicLatLon" begin c1 = LatLon(T(30), T(40)) - c2 = convert(AuthalicLatLon{WGS84}, c1) + c2 = convert(AuthalicLatLon{WGS84Latest}, c1) @test c2 ≈ AuthalicLatLon(T(29.888997034459567), T(40)) - c3 = convert(LatLon{WGS84}, c2) + c3 = convert(LatLon{WGS84Latest}, c2) @test c3 ≈ c1 c1 = LatLon(T(35), T(40)) - c2 = convert(AuthalicLatLon{WGS84}, c1) + c2 = convert(AuthalicLatLon{WGS84Latest}, c1) @test c2 ≈ AuthalicLatLon(T(34.87951854973729), T(40)) - c3 = convert(LatLon{WGS84}, c2) + c3 = convert(LatLon{WGS84Latest}, c2) @test c3 ≈ c1 c1 = LatLon(T(40), T(40)) - c2 = convert(AuthalicLatLon{WGS84}, c1) + c2 = convert(AuthalicLatLon{WGS84Latest}, c1) @test c2 ≈ AuthalicLatLon(T(39.87369373453432), T(40)) - c3 = convert(LatLon{WGS84}, c2) + c3 = convert(LatLon{WGS84Latest}, c2) @test c3 ≈ c1 c1 = LatLon(-T(30), T(40)) - c2 = convert(AuthalicLatLon{WGS84}, c1) + c2 = convert(AuthalicLatLon{WGS84Latest}, c1) @test c2 ≈ AuthalicLatLon(-T(29.888997034459567), T(40)) - c3 = convert(LatLon{WGS84}, c2) + c3 = convert(LatLon{WGS84Latest}, c2) @test c3 ≈ c1 c1 = LatLon(-T(35), T(40)) - c2 = convert(AuthalicLatLon{WGS84}, c1) + c2 = convert(AuthalicLatLon{WGS84Latest}, c1) @test c2 ≈ AuthalicLatLon(-T(34.87951854973729), T(40)) - c3 = convert(LatLon{WGS84}, c2) + c3 = convert(LatLon{WGS84Latest}, c2) @test c3 ≈ c1 c1 = LatLon(-T(40), T(40)) - c2 = convert(AuthalicLatLon{WGS84}, c1) + c2 = convert(AuthalicLatLon{WGS84Latest}, c1) @test c2 ≈ AuthalicLatLon(-T(39.87369373453432), T(40)) - c3 = convert(LatLon{WGS84}, c2) + c3 = convert(LatLon{WGS84Latest}, c2) @test c3 ≈ c1 # type stability c1 = LatLon(T(30), T(40)) c2 = AuthalicLatLon(T(29.888997034459567), T(40)) - @inferred convert(AuthalicLatLon{WGS84}, c1) - @inferred convert(LatLon{WGS84}, c2) + @inferred convert(AuthalicLatLon{WGS84Latest}, c1) + @inferred convert(LatLon{WGS84Latest}, c2) end @testset "LatLon <> Cartesian" begin c1 = LatLon(T(30), T(40)) - c2 = convert(Cartesian{WGS84}, c1) - @test c2 ≈ Cartesian{WGS84}(T(4234890.278665873), T(3553494.8709047823), T(3170373.735383637)) - c3 = convert(LatLon{WGS84}, c2) + c2 = convert(Cartesian{WGS84Latest}, c1) + @test c2 ≈ Cartesian{WGS84Latest}(T(4234890.278665873), T(3553494.8709047823), T(3170373.735383637)) + c3 = convert(LatLon{WGS84Latest}, c2) @test c3 ≈ c1 c1 = LatLon(T(35), T(45)) - c2 = convert(Cartesian{WGS84}, c1) - @test c2 ≈ Cartesian{WGS84}(T(3698470.287205801), T(3698470.2872058), T(3637866.909378095)) - c3 = convert(LatLon{WGS84}, c2) + c2 = convert(Cartesian{WGS84Latest}, c1) + @test c2 ≈ Cartesian{WGS84Latest}(T(3698470.287205801), T(3698470.2872058), T(3637866.909378095)) + c3 = convert(LatLon{WGS84Latest}, c2) @test c3 ≈ c1 c1 = LatLon(T(40), T(50)) - c2 = convert(Cartesian{WGS84}, c1) - @test c2 ≈ Cartesian{WGS84}(T(3144971.82314589), T(3748031.468841677), T(4077985.572200376)) - c3 = convert(LatLon{WGS84}, c2) + c2 = convert(Cartesian{WGS84Latest}, c1) + @test c2 ≈ Cartesian{WGS84Latest}(T(3144971.82314589), T(3748031.468841677), T(4077985.572200376)) + c3 = convert(LatLon{WGS84Latest}, c2) @test c3 ≈ c1 c1 = LatLon(-T(30), -T(40)) - c2 = convert(Cartesian{WGS84}, c1) - @test c2 ≈ Cartesian{WGS84}(T(4234890.278665873), -T(3553494.8709047823), -T(3170373.735383637)) - c3 = convert(LatLon{WGS84}, c2) + c2 = convert(Cartesian{WGS84Latest}, c1) + @test c2 ≈ Cartesian{WGS84Latest}(T(4234890.278665873), -T(3553494.8709047823), -T(3170373.735383637)) + c3 = convert(LatLon{WGS84Latest}, c2) @test c3 ≈ c1 c1 = LatLon(-T(35), T(45)) - c2 = convert(Cartesian{WGS84}, c1) - @test c2 ≈ Cartesian{WGS84}(T(3698470.287205801), T(3698470.2872058), -T(3637866.909378095)) - c3 = convert(LatLon{WGS84}, c2) + c2 = convert(Cartesian{WGS84Latest}, c1) + @test c2 ≈ Cartesian{WGS84Latest}(T(3698470.287205801), T(3698470.2872058), -T(3637866.909378095)) + c3 = convert(LatLon{WGS84Latest}, c2) @test c3 ≈ c1 c1 = LatLon(T(40), -T(50)) - c2 = convert(Cartesian{WGS84}, c1) - @test c2 ≈ Cartesian{WGS84}(T(3144971.82314589), -T(3748031.468841677), T(4077985.572200376)) - c3 = convert(LatLon{WGS84}, c2) + c2 = convert(Cartesian{WGS84Latest}, c1) + @test c2 ≈ Cartesian{WGS84Latest}(T(3144971.82314589), -T(3748031.468841677), T(4077985.572200376)) + c3 = convert(LatLon{WGS84Latest}, c2) @test c3 ≈ c1 # type stability c1 = LatLon(T(30), T(40)) - c2 = Cartesian{WGS84}(T(4234890.278665873), T(3553494.8709047823), T(3170373.735383637)) - @inferred convert(Cartesian{WGS84}, c1) - @inferred convert(LatLon{WGS84}, c2) + c2 = Cartesian{WGS84Latest}(T(4234890.278665873), T(3553494.8709047823), T(3170373.735383637)) + @inferred convert(Cartesian{WGS84Latest}, c1) + @inferred convert(LatLon{WGS84Latest}, c2) end if T === Float64 # altitude can only be calculated accurately using Float64 @testset "LatLonAlt <> Cartesian" begin c1 = LatLonAlt(T(30), T(40), T(0)) - c2 = convert(Cartesian{WGS84}, c1) - @test c2 ≈ Cartesian{WGS84}(T(4234890.278665873), T(3553494.8709047823), T(3170373.735383637)) - c3 = convert(LatLonAlt{WGS84}, c2) + c2 = convert(Cartesian{WGS84Latest}, c1) + @test c2 ≈ Cartesian{WGS84Latest}(T(4234890.278665873), T(3553494.8709047823), T(3170373.735383637)) + c3 = convert(LatLonAlt{WGS84Latest}, c2) @test c3 ≈ c1 c1 = LatLonAlt(T(35), T(45), T(100)) - c2 = convert(Cartesian{WGS84}, c1) - @test c2 ≈ Cartesian{WGS84}(T(3698528.2100023343), T(3698528.2100023334), T(3637924.26702173)) - c3 = convert(LatLonAlt{WGS84}, c2) + c2 = convert(Cartesian{WGS84Latest}, c1) + @test c2 ≈ Cartesian{WGS84Latest}(T(3698528.2100023343), T(3698528.2100023334), T(3637924.26702173)) + c3 = convert(LatLonAlt{WGS84Latest}, c2) @test c3 ≈ c1 c1 = LatLonAlt(T(40), T(50), T(200)) - c2 = convert(Cartesian{WGS84}, c1) - @test c2 ≈ Cartesian{WGS84}(T(3145070.3039211915), T(3748148.8336594435), T(4078114.1297223135)) - c3 = convert(LatLonAlt{WGS84}, c2) + c2 = convert(Cartesian{WGS84Latest}, c1) + @test c2 ≈ Cartesian{WGS84Latest}(T(3145070.3039211915), T(3748148.8336594435), T(4078114.1297223135)) + c3 = convert(LatLonAlt{WGS84Latest}, c2) @test c3 ≈ c1 c1 = LatLonAlt(-T(30), -T(40), T(0)) - c2 = convert(Cartesian{WGS84}, c1) - @test c2 ≈ Cartesian{WGS84}(T(4234890.278665873), -T(3553494.8709047823), -T(3170373.735383637)) - c3 = convert(LatLonAlt{WGS84}, c2) + c2 = convert(Cartesian{WGS84Latest}, c1) + @test c2 ≈ Cartesian{WGS84Latest}(T(4234890.278665873), -T(3553494.8709047823), -T(3170373.735383637)) + c3 = convert(LatLonAlt{WGS84Latest}, c2) @test c3 ≈ c1 c1 = LatLonAlt(-T(35), T(45), T(100)) - c2 = convert(Cartesian{WGS84}, c1) - @test c2 ≈ Cartesian{WGS84}(T(3698528.2100023343), T(3698528.2100023334), -T(3637924.26702173)) - c3 = convert(LatLonAlt{WGS84}, c2) + c2 = convert(Cartesian{WGS84Latest}, c1) + @test c2 ≈ Cartesian{WGS84Latest}(T(3698528.2100023343), T(3698528.2100023334), -T(3637924.26702173)) + c3 = convert(LatLonAlt{WGS84Latest}, c2) @test c3 ≈ c1 c1 = LatLonAlt(T(40), -T(50), T(200)) - c2 = convert(Cartesian{WGS84}, c1) - @test c2 ≈ Cartesian{WGS84}(T(3145070.3039211915), -T(3748148.8336594435), T(4078114.1297223135)) - c3 = convert(LatLonAlt{WGS84}, c2) + c2 = convert(Cartesian{WGS84Latest}, c1) + @test c2 ≈ Cartesian{WGS84Latest}(T(3145070.3039211915), -T(3748148.8336594435), T(4078114.1297223135)) + c3 = convert(LatLonAlt{WGS84Latest}, c2) @test c3 ≈ c1 # type stability c1 = LatLonAlt(T(30), T(40), T(0)) - c2 = Cartesian{WGS84}(T(4234890.278665873), T(3553494.8709047823), T(3170373.735383637)) - @inferred convert(Cartesian{WGS84}, c1) - @inferred convert(LatLonAlt{WGS84}, c2) + c2 = Cartesian{WGS84Latest}(T(4234890.278665873), T(3553494.8709047823), T(3170373.735383637)) + @inferred convert(Cartesian{WGS84Latest}, c1) + @inferred convert(LatLonAlt{WGS84Latest}, c2) end end @testset "LatLon <> Mercator" begin c1 = LatLon(T(45), T(90)) - c2 = convert(Mercator{WGS84}, c1) + c2 = convert(Mercator{WGS84Latest}, c1) @test c2 ≈ Mercator(T(10018754.171394622), T(5591295.9185533915)) - c3 = convert(LatLon{WGS84}, c2) + c3 = convert(LatLon{WGS84Latest}, c2) @test c3 ≈ c1 c1 = LatLon(-T(45), T(90)) - c2 = convert(Mercator{WGS84}, c1) + c2 = convert(Mercator{WGS84Latest}, c1) @test c2 ≈ Mercator(T(10018754.171394622), -T(5591295.9185533915)) - c3 = convert(LatLon{WGS84}, c2) + c3 = convert(LatLon{WGS84Latest}, c2) @test c3 ≈ c1 c1 = LatLon(T(45), -T(90)) - c2 = convert(Mercator{WGS84}, c1) + c2 = convert(Mercator{WGS84Latest}, c1) @test c2 ≈ Mercator(-T(10018754.171394622), T(5591295.9185533915)) - c3 = convert(LatLon{WGS84}, c2) + c3 = convert(LatLon{WGS84Latest}, c2) @test c3 ≈ c1 c1 = LatLon(-T(45), -T(90)) - c2 = convert(Mercator{WGS84}, c1) + c2 = convert(Mercator{WGS84Latest}, c1) @test c2 ≈ Mercator(-T(10018754.171394622), -T(5591295.9185533915)) - c3 = convert(LatLon{WGS84}, c2) + c3 = convert(LatLon{WGS84Latest}, c2) @test c3 ≈ c1 # type stability c1 = LatLon(T(45), T(90)) c2 = Mercator(T(10018754.171394622), T(5591295.9185533915)) - @inferred convert(Mercator{WGS84}, c1) - @inferred convert(LatLon{WGS84}, c2) + @inferred convert(Mercator{WGS84Latest}, c1) + @inferred convert(LatLon{WGS84Latest}, c2) end @testset "LatLon <> WebMercator" begin c1 = LatLon(T(45), T(90)) - c2 = convert(WebMercator{WGS84}, c1) + c2 = convert(WebMercator{WGS84Latest}, c1) @test c2 ≈ WebMercator(T(10018754.171394622), T(5621521.486192066)) - c3 = convert(LatLon{WGS84}, c2) + c3 = convert(LatLon{WGS84Latest}, c2) @test c3 ≈ c1 c1 = LatLon(-T(45), T(90)) - c2 = convert(WebMercator{WGS84}, c1) + c2 = convert(WebMercator{WGS84Latest}, c1) @test c2 ≈ WebMercator(T(10018754.171394622), -T(5621521.486192066)) - c3 = convert(LatLon{WGS84}, c2) + c3 = convert(LatLon{WGS84Latest}, c2) @test c3 ≈ c1 c1 = LatLon(T(45), -T(90)) - c2 = convert(WebMercator{WGS84}, c1) + c2 = convert(WebMercator{WGS84Latest}, c1) @test c2 ≈ WebMercator(-T(10018754.171394622), T(5621521.486192066)) - c3 = convert(LatLon{WGS84}, c2) + c3 = convert(LatLon{WGS84Latest}, c2) @test c3 ≈ c1 c1 = LatLon(-T(45), -T(90)) - c2 = convert(WebMercator{WGS84}, c1) + c2 = convert(WebMercator{WGS84Latest}, c1) @test c2 ≈ WebMercator(-T(10018754.171394622), -T(5621521.486192066)) - c3 = convert(LatLon{WGS84}, c2) + c3 = convert(LatLon{WGS84Latest}, c2) @test c3 ≈ c1 # type stability c1 = LatLon(T(45), T(90)) c2 = WebMercator(T(10018754.171394622), T(5621521.486192066)) - @inferred convert(WebMercator{WGS84}, c1) - @inferred convert(LatLon{WGS84}, c2) + @inferred convert(WebMercator{WGS84Latest}, c1) + @inferred convert(LatLon{WGS84Latest}, c2) end @testset "LatLon <> PlateCarree" begin c1 = LatLon(T(45), T(90)) - c2 = convert(PlateCarree{WGS84}, c1) + c2 = convert(PlateCarree{WGS84Latest}, c1) @test c2 ≈ PlateCarree(T(10018754.171394622), T(5009377.085697311)) - c3 = convert(LatLon{WGS84}, c2) + c3 = convert(LatLon{WGS84Latest}, c2) @test c3 ≈ c1 c1 = LatLon(-T(45), T(90)) - c2 = convert(PlateCarree{WGS84}, c1) + c2 = convert(PlateCarree{WGS84Latest}, c1) @test c2 ≈ PlateCarree(T(10018754.171394622), -T(5009377.085697311)) - c3 = convert(LatLon{WGS84}, c2) + c3 = convert(LatLon{WGS84Latest}, c2) @test c3 ≈ c1 c1 = LatLon(T(45), -T(90)) - c2 = convert(PlateCarree{WGS84}, c1) + c2 = convert(PlateCarree{WGS84Latest}, c1) @test c2 ≈ PlateCarree(-T(10018754.171394622), T(5009377.085697311)) - c3 = convert(LatLon{WGS84}, c2) + c3 = convert(LatLon{WGS84Latest}, c2) @test c3 ≈ c1 c1 = LatLon(-T(45), -T(90)) - c2 = convert(PlateCarree{WGS84}, c1) + c2 = convert(PlateCarree{WGS84Latest}, c1) @test c2 ≈ PlateCarree(-T(10018754.171394622), -T(5009377.085697311)) - c3 = convert(LatLon{WGS84}, c2) + c3 = convert(LatLon{WGS84Latest}, c2) @test c3 ≈ c1 # type stability c1 = LatLon(T(45), T(90)) c2 = PlateCarree(T(10018754.171394622), T(5009377.085697311)) - @inferred convert(PlateCarree{WGS84}, c1) - @inferred convert(LatLon{WGS84}, c2) + @inferred convert(PlateCarree{WGS84Latest}, c1) + @inferred convert(LatLon{WGS84Latest}, c2) end @testset "LatLon <> Lambert" begin c1 = LatLon(T(45), T(90)) - c2 = convert(Lambert{WGS84}, c1) + c2 = convert(Lambert{WGS84Latest}, c1) @test c2 ≈ Lambert(T(10018754.171394622), T(4489858.8869480025)) - c3 = convert(LatLon{WGS84}, c2) + c3 = convert(LatLon{WGS84Latest}, c2) @test c3 ≈ c1 c1 = LatLon(-T(45), T(90)) - c2 = convert(Lambert{WGS84}, c1) + c2 = convert(Lambert{WGS84Latest}, c1) @test c2 ≈ Lambert(T(10018754.171394622), -T(4489858.8869480025)) - c3 = convert(LatLon{WGS84}, c2) + c3 = convert(LatLon{WGS84Latest}, c2) @test c3 ≈ c1 c1 = LatLon(T(45), -T(90)) - c2 = convert(Lambert{WGS84}, c1) + c2 = convert(Lambert{WGS84Latest}, c1) @test c2 ≈ Lambert(-T(10018754.171394622), T(4489858.8869480025)) - c3 = convert(LatLon{WGS84}, c2) + c3 = convert(LatLon{WGS84Latest}, c2) @test c3 ≈ c1 c1 = LatLon(-T(45), -T(90)) - c2 = convert(Lambert{WGS84}, c1) + c2 = convert(Lambert{WGS84Latest}, c1) @test c2 ≈ Lambert(-T(10018754.171394622), -T(4489858.8869480025)) - c3 = convert(LatLon{WGS84}, c2) + c3 = convert(LatLon{WGS84Latest}, c2) @test c3 ≈ c1 # type stability c1 = LatLon(T(45), T(90)) c2 = Lambert(T(10018754.171394622), T(4489858.8869480025)) - @inferred convert(Lambert{WGS84}, c1) - @inferred convert(LatLon{WGS84}, c2) + @inferred convert(Lambert{WGS84Latest}, c1) + @inferred convert(LatLon{WGS84Latest}, c2) end @testset "LatLon <> Behrmann" begin c1 = LatLon(T(45), T(90)) - c2 = convert(Behrmann{WGS84}, c1) + c2 = convert(Behrmann{WGS84Latest}, c1) @test c2 ≈ Behrmann(T(8683765.222580686), T(5180102.328839251)) - c3 = convert(LatLon{WGS84}, c2) + c3 = convert(LatLon{WGS84Latest}, c2) @test c3 ≈ c1 c1 = LatLon(-T(45), T(90)) - c2 = convert(Behrmann{WGS84}, c1) + c2 = convert(Behrmann{WGS84Latest}, c1) @test c2 ≈ Behrmann(T(8683765.222580686), -T(5180102.328839251)) - c3 = convert(LatLon{WGS84}, c2) + c3 = convert(LatLon{WGS84Latest}, c2) @test c3 ≈ c1 c1 = LatLon(T(45), -T(90)) - c2 = convert(Behrmann{WGS84}, c1) + c2 = convert(Behrmann{WGS84Latest}, c1) @test c2 ≈ Behrmann(-T(8683765.222580686), T(5180102.328839251)) - c3 = convert(LatLon{WGS84}, c2) + c3 = convert(LatLon{WGS84Latest}, c2) @test c3 ≈ c1 c1 = LatLon(-T(45), -T(90)) - c2 = convert(Behrmann{WGS84}, c1) + c2 = convert(Behrmann{WGS84Latest}, c1) @test c2 ≈ Behrmann(-T(8683765.222580686), -T(5180102.328839251)) - c3 = convert(LatLon{WGS84}, c2) + c3 = convert(LatLon{WGS84Latest}, c2) @test c3 ≈ c1 # type stability c1 = LatLon(T(45), T(90)) c2 = Behrmann(T(8683765.222580686), T(5180102.328839251)) - @inferred convert(Behrmann{WGS84}, c1) - @inferred convert(LatLon{WGS84}, c2) + @inferred convert(Behrmann{WGS84Latest}, c1) + @inferred convert(LatLon{WGS84Latest}, c2) end @testset "LatLon <> GallPeters" begin c1 = LatLon(T(45), T(90)) - c2 = convert(GallPeters{WGS84}, c1) + c2 = convert(GallPeters{WGS84Latest}, c1) @test c2 ≈ GallPeters(T(7096215.158458031), T(6338983.732612475)) - c3 = convert(LatLon{WGS84}, c2) + c3 = convert(LatLon{WGS84Latest}, c2) @test c3 ≈ c1 c1 = LatLon(-T(45), T(90)) - c2 = convert(GallPeters{WGS84}, c1) + c2 = convert(GallPeters{WGS84Latest}, c1) @test c2 ≈ GallPeters(T(7096215.158458031), -T(6338983.732612475)) - c3 = convert(LatLon{WGS84}, c2) + c3 = convert(LatLon{WGS84Latest}, c2) @test c3 ≈ c1 c1 = LatLon(T(45), -T(90)) - c2 = convert(GallPeters{WGS84}, c1) + c2 = convert(GallPeters{WGS84Latest}, c1) @test c2 ≈ GallPeters(-T(7096215.158458031), T(6338983.732612475)) - c3 = convert(LatLon{WGS84}, c2) + c3 = convert(LatLon{WGS84Latest}, c2) @test c3 ≈ c1 c1 = LatLon(-T(45), -T(90)) - c2 = convert(GallPeters{WGS84}, c1) + c2 = convert(GallPeters{WGS84Latest}, c1) @test c2 ≈ GallPeters(-T(7096215.158458031), -T(6338983.732612475)) - c3 = convert(LatLon{WGS84}, c2) + c3 = convert(LatLon{WGS84Latest}, c2) @test c3 ≈ c1 # type stability c1 = LatLon(T(45), T(90)) c2 = GallPeters(T(7096215.158458031), T(6338983.732612475)) - @inferred convert(GallPeters{WGS84}, c1) - @inferred convert(LatLon{WGS84}, c2) + @inferred convert(GallPeters{WGS84Latest}, c1) + @inferred convert(LatLon{WGS84Latest}, c2) end @testset "LatLon <> WinkelTripel" begin c1 = LatLon(T(45), T(90)) - c2 = convert(WinkelTripel{WGS84}, c1) + c2 = convert(WinkelTripel{WGS84Latest}, c1) @test c2 ≈ WinkelTripel(T(7044801.6979576545), T(5231448.051548355)) - c3 = convert(LatLon{WGS84}, c2) + c3 = convert(LatLon{WGS84Latest}, c2) @test c3 ≈ c1 c1 = LatLon(-T(45), T(90)) - c2 = convert(WinkelTripel{WGS84}, c1) + c2 = convert(WinkelTripel{WGS84Latest}, c1) @test c2 ≈ WinkelTripel(T(7044801.6979576545), -T(5231448.051548355)) - c3 = convert(LatLon{WGS84}, c2) + c3 = convert(LatLon{WGS84Latest}, c2) @test c3 ≈ c1 c1 = LatLon(T(45), -T(90)) - c2 = convert(WinkelTripel{WGS84}, c1) + c2 = convert(WinkelTripel{WGS84Latest}, c1) @test c2 ≈ WinkelTripel(-T(7044801.6979576545), T(5231448.051548355)) - c3 = convert(LatLon{WGS84}, c2) + c3 = convert(LatLon{WGS84Latest}, c2) @test c3 ≈ c1 c1 = LatLon(-T(45), -T(90)) - c2 = convert(WinkelTripel{WGS84}, c1) + c2 = convert(WinkelTripel{WGS84Latest}, c1) @test c2 ≈ WinkelTripel(-T(7044801.6979576545), -T(5231448.051548355)) - c3 = convert(LatLon{WGS84}, c2) + c3 = convert(LatLon{WGS84Latest}, c2) @test c3 ≈ c1 c1 = LatLon(T(0), T(0)) - c2 = convert(WinkelTripel{WGS84}, c1) + c2 = convert(WinkelTripel{WGS84Latest}, c1) @test c2 ≈ WinkelTripel(T(0), T(0)) - c3 = convert(LatLon{WGS84}, c2) + c3 = convert(LatLon{WGS84Latest}, c2) @test c3 ≈ c1 # type stability c1 = LatLon(T(45), T(90)) c2 = WinkelTripel(T(7044801.6979576545), T(5231448.051548355)) - @inferred convert(WinkelTripel{WGS84}, c1) - @inferred convert(LatLon{WGS84}, c2) + @inferred convert(WinkelTripel{WGS84Latest}, c1) + @inferred convert(LatLon{WGS84Latest}, c2) end @testset "LatLon <> Robinson" begin c1 = LatLon(T(45), T(90)) - c2 = convert(Robinson{WGS84}, c1) + c2 = convert(Robinson{WGS84Latest}, c1) @test c2 ≈ Robinson(T(7620313.925950073), T(4805073.646653474)) - c3 = convert(LatLon{WGS84}, c2) + c3 = convert(LatLon{WGS84Latest}, c2) @test c3 ≈ c1 c1 = LatLon(-T(45), T(90)) - c2 = convert(Robinson{WGS84}, c1) + c2 = convert(Robinson{WGS84Latest}, c1) @test c2 ≈ Robinson(T(7620313.925950073), -T(4805073.646653474)) - c3 = convert(LatLon{WGS84}, c2) + c3 = convert(LatLon{WGS84Latest}, c2) @test c3 ≈ c1 c1 = LatLon(T(45), -T(90)) - c2 = convert(Robinson{WGS84}, c1) + c2 = convert(Robinson{WGS84Latest}, c1) @test c2 ≈ Robinson(-T(7620313.925950073), T(4805073.646653474)) - c3 = convert(LatLon{WGS84}, c2) + c3 = convert(LatLon{WGS84Latest}, c2) @test c3 ≈ c1 c1 = LatLon(-T(45), -T(90)) - c2 = convert(Robinson{WGS84}, c1) + c2 = convert(Robinson{WGS84Latest}, c1) @test c2 ≈ Robinson(-T(7620313.925950073), -T(4805073.646653474)) - c3 = convert(LatLon{WGS84}, c2) + c3 = convert(LatLon{WGS84Latest}, c2) @test c3 ≈ c1 # type stability c1 = LatLon(T(45), T(90)) c2 = Robinson(T(7620313.925950073), T(4805073.646653474)) - @inferred convert(Robinson{WGS84}, c1) - @inferred convert(LatLon{WGS84}, c2) + @inferred convert(Robinson{WGS84Latest}, c1) + @inferred convert(LatLon{WGS84Latest}, c2) end @testset "LatLon <> OrthoNorth" begin c1 = LatLon(T(30), T(60)) - c2 = convert(OrthoNorth{WGS84}, c1) + c2 = convert(OrthoNorth{WGS84Latest}, c1) @test c2 ≈ OrthoNorth(T(4787610.688267582), T(-2764128.319646418)) - c3 = convert(LatLon{WGS84}, c2) + c3 = convert(LatLon{WGS84Latest}, c2) @test c3 ≈ c1 c1 = LatLon(T(30), -T(60)) - c2 = convert(OrthoNorth{WGS84}, c1) + c2 = convert(OrthoNorth{WGS84Latest}, c1) @test c2 ≈ OrthoNorth(-T(4787610.688267582), T(-2764128.319646418)) - c3 = convert(LatLon{WGS84}, c2) + c3 = convert(LatLon{WGS84Latest}, c2) @test c3 ≈ c1 # type stability c1 = LatLon(T(30), T(60)) c2 = OrthoNorth(T(4787610.688267582), T(-2764128.319646418)) - @inferred convert(OrthoNorth{WGS84}, c1) - @inferred convert(LatLon{WGS84}, c2) + @inferred convert(OrthoNorth{WGS84Latest}, c1) + @inferred convert(LatLon{WGS84Latest}, c2) end @testset "LatLon <> OrthoSouth" begin c1 = LatLon(-T(30), T(60)) - c2 = convert(OrthoSouth{WGS84}, c1) + c2 = convert(OrthoSouth{WGS84Latest}, c1) @test c2 ≈ OrthoSouth(T(4787610.688267582), T(2764128.319646418)) - c3 = convert(LatLon{WGS84}, c2) + c3 = convert(LatLon{WGS84Latest}, c2) @test c3 ≈ c1 c1 = LatLon(-T(30), -T(60)) - c2 = convert(OrthoSouth{WGS84}, c1) + c2 = convert(OrthoSouth{WGS84Latest}, c1) @test c2 ≈ OrthoSouth(-T(4787610.688267582), T(2764128.319646418)) - c3 = convert(LatLon{WGS84}, c2) + c3 = convert(LatLon{WGS84Latest}, c2) @test c3 ≈ c1 # type stability c1 = LatLon(-T(30), T(60)) c2 = OrthoSouth(T(4787610.688267582), T(2764128.319646418)) - @inferred convert(OrthoSouth{WGS84}, c1) - @inferred convert(LatLon{WGS84}, c2) + @inferred convert(OrthoSouth{WGS84Latest}, c1) + @inferred convert(LatLon{WGS84Latest}, c2) end @testset "LatLon <> OrthoSpherical" begin @@ -1170,25 +1170,25 @@ c1 = LatLon(T(30), T(60)) c2 = convert(OrthoNorthSpherical, c1) @test c2 ≈ OrthoNorthSpherical(T(4783602.75), T(-2761814.335408735)) - c3 = convert(LatLon{WGS84}, c2) + c3 = convert(LatLon{WGS84Latest}, c2) @test c3 ≈ c1 c1 = LatLon(T(30), -T(60)) c2 = convert(OrthoNorthSpherical, c1) @test c2 ≈ OrthoNorthSpherical(-T(4783602.75), T(-2761814.335408735)) - c3 = convert(LatLon{WGS84}, c2) + c3 = convert(LatLon{WGS84Latest}, c2) @test c3 ≈ c1 c1 = LatLon(-T(30), T(60)) c2 = convert(OrthoSouthSpherical, c1) @test c2 ≈ OrthoSouthSpherical(T(4783602.75), T(2761814.335408735)) - c3 = convert(LatLon{WGS84}, c2) + c3 = convert(LatLon{WGS84Latest}, c2) @test c3 ≈ c1 c1 = LatLon(-T(30), -T(60)) c2 = convert(OrthoSouthSpherical, c1) @test c2 ≈ OrthoSouthSpherical(-T(4783602.75), T(2761814.335408735)) - c3 = convert(LatLon{WGS84}, c2) + c3 = convert(LatLon{WGS84Latest}, c2) @test c3 ≈ c1 # type stability @@ -1197,8 +1197,8 @@ c3 = OrthoSouthSpherical(T(4783602.75), T(2761814.335408735)) @inferred convert(OrthoNorthSpherical, c1) @inferred convert(OrthoSouthSpherical, c1) - @inferred convert(LatLon{WGS84}, c2) - @inferred convert(LatLon{WGS84}, c3) + @inferred convert(LatLon{WGS84Latest}, c2) + @inferred convert(LatLon{WGS84Latest}, c3) end end end diff --git a/test/datums.jl b/test/datums.jl index d17fedd..2d0f2de 100644 --- a/test/datums.jl +++ b/test/datums.jl @@ -7,7 +7,7 @@ end @testset "WGS84" begin - 🌎 = ellipsoid(WGS84) + 🌎 = ellipsoid(WGS84Latest) @test majoraxis(🌎) == 6378137.0u"m" @test minoraxis(🌎) == 6356752.314245179u"m" @test eccentricity(🌎) == 0.08181919084262149 @@ -15,8 +15,41 @@ @test flattening(🌎) == 0.0033528106647474805 @test flattening⁻¹(🌎) == 298.257223563 - @test latitudeₒ(WGS84) == 0.0u"°" - @test longitudeₒ(WGS84) == 0.0u"°" - @test altitudeₒ(WGS84) == 0.0u"m" + @test latitudeₒ(WGS84Latest) == 0.0u"°" + @test longitudeₒ(WGS84Latest) == 0.0u"°" + @test altitudeₒ(WGS84Latest) == 0.0u"m" + + @test isnothing(epoch(WGS84{0})) + @test epoch(WGS84{730}) == 1994.0 + @test epoch(WGS84{873}) == 1997.0 + @test epoch(WGS84{1150}) == 2001.0 + @test epoch(WGS84{1674}) == 2005.0 + @test epoch(WGS84{1762}) == 2005.0 + end + + @testset "ITRF" begin + 🌎 = ellipsoid(ITRFLatest) + @test majoraxis(🌎) == 6378137.0u"m" + @test minoraxis(🌎) == 6356752.314140356u"m" + @test eccentricity(🌎) == 0.08181919104281579 + @test eccentricity²(🌎) == 0.006694380022900787 + @test flattening(🌎) == 0.003352810681182319 + @test flattening⁻¹(🌎) == 298.257222101 + + @test latitudeₒ(ITRFLatest) == 0.0u"°" + @test longitudeₒ(ITRFLatest) == 0.0u"°" + @test altitudeₒ(ITRFLatest) == 0.0u"m" + + @test epoch(ITRF{1991}) == 1988.0 + @test epoch(ITRF{1992}) == 1988.0 + @test epoch(ITRF{1993}) == 1988.0 + @test epoch(ITRF{1994}) == 1993.0 + @test epoch(ITRF{1996}) == 1997.0 + @test epoch(ITRF{1997}) == 1997.0 + @test epoch(ITRF{2000}) == 1997.0 + @test epoch(ITRF{2005}) == 2000.0 + @test epoch(ITRF{2008}) == 2005.0 + @test epoch(ITRF{2014}) == 2010.0 + @test epoch(ITRF{2020}) == 2015.0 end end