Skip to content

refactor: Move geo utilities#7881

Merged
camdecoster merged 4 commits into
masterfrom
cam/7879/move-geo-utilities
Jul 1, 2026
Merged

refactor: Move geo utilities#7881
camdecoster merged 4 commits into
masterfrom
cam/7879/move-geo-utilities

Conversation

@camdecoster

Copy link
Copy Markdown
Contributor

Description

Move a number of geo related utilities to a central location for use throughout the library.

Closes #7879.

Changes

  • Move getFitboundsLonRange, doesCrossAntiMeridian
  • Create unwrapLonRange, ANTIMERIDIAN_LON_SHIFT
  • Move/add tests

Testing

  • Check CI

@camdecoster camdecoster added the no-draftlog The associated PR doesn't require a draftlog and the CI check will be skipped. label Jun 29, 2026
Comment thread src/lib/geo_location_utils.js Outdated
* Return a monotonic version of a `[lon0, lon1]` longitude range so its
* midpoint and span can be computed as if longitude were a regular linear
* coordinate. When the range crosses the antimeridian (`lon0 > 0`, `lon1 < 0`)
* `lon1` is shifted by +360°; otherwise the input pair is returned unchanged.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Wording suggestion for clarity

Suggested change
* `lon1` is shifted by +360°; otherwise the input pair is returned unchanged.
* 360 is added to `lon1`; otherwise the input pair is returned unchanged.

Comment thread src/lib/geo_location_utils.js Outdated
* `lon1` is shifted by +360°; otherwise the input pair is returned unchanged.
*
* @param {[number, number]} lonRange - `[lon0, lon1]`, each in [-180, 180]
* @return {[number, number]} the unwrapped range

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can you expand this description to give the possible range of the returned numbers? I can sort of figure it out by reading the above docstring but it would be clearer to state it explicitly here.

emilykl
emilykl previously approved these changes Jun 30, 2026
@camdecoster camdecoster merged commit b633ef4 into master Jul 1, 2026
8 checks passed
@camdecoster camdecoster deleted the cam/7879/move-geo-utilities branch July 1, 2026 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-draftlog The associated PR doesn't require a draftlog and the CI check will be skipped.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[CHORE]: Move geo related helper functions into geo_location_utils

2 participants