Skip to content
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

fix albers edge cases and lambert center #11229

Merged
merged 4 commits into from Nov 5, 2021
Merged

fix albers edge cases and lambert center #11229

merged 4 commits into from Nov 5, 2021

Conversation

ansis
Copy link
Contributor

@ansis ansis commented Nov 5, 2021

fix #11228

The albers implementation was not solid. If the parallels were negative enough unproject would return an incorrect value. Some other situations would return NaN. Switch to one based on d3-geo (thanks!) which is much more robust.

Lambert was not using the center longitude. Now it does.

Cylindrical equal area is not meaningful for [-90, 90]. I added a min value to avoid errors elsewhere.

Launch Checklist

  • briefly describe the changes in this PR
  • include before/after visuals or gifs if this PR includes visual changes
  • write tests for all new functionality
  • manually test the debug page
  • apply changelog label ('bug', 'feature', 'docs', etc) or use the label 'skip changelog'

The albers implementation was not solid. Switch to one based on d3-geo
(thanks!) which is much more robust.

Lambert was not using the center longitude.
Copy link
Contributor

@ryanhamley ryanhamley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me. It definitely fixes the buggy behavior

@ansis ansis requested a review from karimnaaji November 5, 2021 02:28
@mourner
Copy link
Member

mourner commented Nov 5, 2021

@ansis I added a commit that brings back the Albers wrapping correction in the new implementation (plus a minor cleanup). Without it, this happens:

Screen.Recording.2021-11-05.at.08.56.12.mov

@ansis ansis merged commit 24a58b7 into main Nov 5, 2021
@ansis ansis deleted the fix-albers branch November 5, 2021 14:45
ansis added a commit that referenced this pull request Nov 5, 2021
* fix albers edge cases and lambert center

The albers implementation was not solid. Switch to one based on d3-geo
(thanks!) which is much more robust.

Lambert was not using the center longitude.

* bring back albers wrap correction

Co-authored-by: Vladimir Agafonkin <agafonkin@gmail.com>
SnailBones pushed a commit that referenced this pull request Nov 5, 2021
* fix albers edge cases and lambert center

The albers implementation was not solid. Switch to one based on d3-geo
(thanks!) which is much more robust.

Lambert was not using the center longitude.

* bring back albers wrap correction

Co-authored-by: Vladimir Agafonkin <agafonkin@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Non-mercator projection may result in invalid LatLng object
3 participants