Cartesian isapprox should do vector comparison instead of elementwise comparison
ettersi opened this issue · 0 comments
ettersi commented
isapprox(::Cartesian, ::Cartesian)
currently fails for points with lon ≈ ±90°
(e.g. Memphis, Tennessee).
julia> r = convert(Cartesian, LatLon(0,0)).x
6.378137e6 m
julia> convert(Cartesian, LatLon(0, 90)) ≈ Cartesian{WGS84Latest}(0u"m", r, 0u"m")
false
The problem is that isapprox(::Cartesian, ::Cartesian)
currently compares every entry one by one for approximate equality.
CoordRefSystems.jl/src/crs/basic.jl
Lines 61 to 65 in 14940f9
Instead, it should do a vector comparison, isapprox(x::Cartesian, y::Cartesian) = norm(x - y) / max(norm(x), norm(y))
, analogous to how Base
does it.