-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Validity of longitudes and latitudes #52
Comments
Good questions.
julia> lon = 1/60 # one arc minute
0.016666666666666666
julia> (lon + 360) - 360 == lon
false |
This is really interesting. Where should the validation occur? We can definitely verify that the latitude is sensible for UTM conversions and catch that case. Should user's be expected to do the same with their code? Or should the inner constructor do it for them? I could go any way on this... I'd probably be tempted to trust the user to do the right thing and just treat |
Yes I could go either way as well. Having the julia> s = "\xff"
"\xff"
julia> s[1]
'\xff': Malformed UTF-8 (category Ma: Malformed, bad data) |
Currently, no check is done on the range of values when either constructing or converting
LLA
s orLatLon
s:(It appears the
ECEF
conversion works as if the latitude wraps around over the pole, whilst clearly the UTM conversion needs valid latitudes.)It is also the case that longitudes are compared as if they are linear numbers, when in reality they are periodic, and thus two points can represent the same position when n × 360° apart but not be 'equal':
This raises a few questions:
a. be normalised to a range on construction (say [–180,180] or [0,360]); or
b. be compared modulo 360 when comparing
LLA
s andLatLon
s; orc. remain unnormalised and points only be equal when longitudes are strictly the same?
Letting the user make their own mistakes is an acceptable approach, but I think it should be noted carefully somewhere if this is the case. Alternatively, the safety net of bailing out when
abs(latitude) > 90
is often worth the effort, not least since it quite often might catch cases of latitude and longitude being mixed up!Happy to submit a PR for whichever route is best.
(My own preference would be for enforcement of
-90 ≤ lat ≤ 90
in construction forLLA
s andLatLon
s, and modulo-360 comparison of longitudes. This allows one to keep longitudes around some arbitrary meridian.)The text was updated successfully, but these errors were encountered: