Skip to content

fix(CoordinateUtils): label zero latitude/longitude as N/E in coordinateString - #549

Merged
makrsmark merged 1 commit into
airframesio:masterfrom
SAY-5:fix/coordinate-string-zero-hemisphere
Oct 25, 2026
Merged

makrsmark merged 1 commit into
airframesio:masterfrom
SAY-5:fix/coordinate-string-zero-hemisphere

Conversation

@SAY-5

@SAY-5 SAY-5 commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #452

coordinateString used a strict > 0 check for the hemisphere, so a latitude of exactly 0 came out as S and a longitude of exactly 0 as W. It now uses >= 0, which matches getDirection treating N/E as the positive side, and there is a test for the 0/0 case in coordinate_utils.test.ts.

Summary by CodeRabbit

  • Bug Fixes
    • Zero latitude and longitude are now displayed with north and east directions.

…ateString

Signed-off-by: Sai Asish Y <say.apm35@gmail.com>
@coderabbitai

coderabbitai Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 8ef2b880-7c5b-490a-8147-22e07cc030d1
Commits

Reviewing files that changed from the base of the PR and between d4fa50d and 6f205b3.

Files selected for processing: 2
  • lib/utils/coordinate_utils.test.ts
  • lib/utils/coordinate_utils.ts

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

Walkthrough

CoordinateUtils.coordinateString now labels zero latitude as north and zero longitude as east. A test checks that zero coordinates format as 0.000 N, 0.000 E.

Changes

Coordinate string formatting

Layer / File(s) Summary
Direction formatting and test
lib/utils/coordinate_utils.ts, lib/utils/coordinate_utils.test.ts
The direction checks now use >= 0 for latitude and longitude. A test verifies the formatted output for zero coordinates.

Priority: Low

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix · Severity of issue fixed: Low

Suggested reviewers: makrsmark

Merge Risk: Minimal · up to 6f205

No actionable merge-blocking risk remains.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: labeling zero latitude and longitude as N/E in CoordinateUtils.coordinateString.
Linked Issues check Passed Issue #452 requires zero latitude to use N and zero longitude to use E in coordinateString, consistent with getDirection. The PR changes both checks from > 0 to >= 0. The new test verifies `{ …
Out of Scope Changes check Passed The PR changes only the two hemisphere checks in lib/utils/coordinate_utils.ts and adds the requested regression test in lib/utils/coordinate_utils.test.ts. These changes directly implement issue …
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2…
Full details: Linked Issues check

Explanation

Issue #452 requires zero latitude to use N and zero longitude to use E in coordinateString, consistent with getDirection. The PR changes both checks from &gt; 0 to &gt;= 0. The new test verifies { latitude: 0, longitude: 0 } formats as 0.000 N, 0.000 E. The non-finite input note is optional and is not a required objective.

Full details: Out of Scope Changes check

Explanation

The PR changes only the two hemisphere checks in lib/utils/coordinate_utils.ts and adds the requested regression test in lib/utils/coordinate_utils.test.ts. These changes directly implement issue #452. No unrelated change is shown.

Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2 files.

Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

A rabbit checks the zero line,
North and east now both align.
Three neat decimals softly show,
For coordinates set to zero.
Hop, the labels now are right!

Comment @coderabbitai help to get the list of available commands.

@makrsmark makrsmark left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This probably doesn't actually matter, but sure

@makrsmark
makrsmark merged commit cc880e7 into airframesio:master Oct 25, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: CoordinateUtils.coordinateString misclassifies the equator (0° lat) as 'S' and the prime meridian (0° lon) as 'W'

2 participants