-
Notifications
You must be signed in to change notification settings - Fork 503
WIP: Constrain longitude between -180 and 180 #93
New issue
Conversation
I don't object, but technically this might need to be a major version change, and as such might be worth putting off. Though in practice it wouldn't actually break the Java or JS bindings, it would just render their normalization functions unnecessary. Would like thoughts from @isaacbrodsky and @dfellis. |
(I should have added, thanks for the PR! I didn't actually realize this change could be implemented in such a minimal fashion.) |
I'm really excited for this change, and also surprised that nothing needed to be done to the handling of latitudes, which I thought were similarly in the Since it still accepts inputs greater than Pi for latitude and then converts them to the expected range, I don't think this is a backwards incompatible change (since the greater than Pi radians are equivalent to the less than 0 radians on the globe), especially for those using the bindings where it will run it through the My only concerns are whether or not other parts of the code have hardwired expectations of only positive radians. The test suite shows that |
The test failures for |
@zachasme thanks for the PR, I think it definitely makes sense to move this into the core rather than the bindings. You may want to rebase now that #94 is merged, since that improves support for negative coordinates. I don't think this requires a major version bump. Input should not be impacted and supported both negative and positive coordinates before. Output is different but is equivalent, and bindings were doing this transform before anyways. |
Hi @zachasme - I think we're all on board for this change. Are you planning to do the test updates, or should one of the maintainers take this on? |
I'm planning to finish this when I get back from vacation next week. |
1364e4e
to
5c55f79
Compare
The failure in I'm updating the test inputfiles using
which fixes many tests, but it appears some hexes still produce longitudes outside the range. How did you originally produce your test inputfiles? |
Hm. I will look into this today.
|
Re test failures in Patch for this:
|
I have applied the patch from @nrabinowitz, and fixed the remaining tests as well. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM - thanks for putting this together!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I looked at the test files I was initially a little surprised rand05centers.txt wasn't updated, but it turned out the geoToH3 test didn't need any update.
@@ -127,6 +127,9 @@ double constrainLng(double lng) { | |||
while (lng > M_PI) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be nice to replace this with something constant time in the future
Update examples and docs for longitude range change (#93)
Constrain longitude between -180 and 180
Update examples and docs for longitude range change (uber#93)
The longitude range [0,360] tripped me up. Are you still interested in pushing the [-180,180] range down to C code, cf. this comment?
If so I will go over the test suite as well.