Skip to content

refactor: Move geo utilities#7881

Open
camdecoster wants to merge 3 commits into
masterfrom
cam/7879/move-geo-utilities
Open

refactor: Move geo utilities#7881
camdecoster wants to merge 3 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
* 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.

* `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.

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