Measure Tool reverses Magnetic Variation when crossing 180 Meridian

Open
#5,304 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
55/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
c
Domain
desktop

Research direction

Start by locating the Measure tool’s magnetic-variation calculation and how it handles longitude across the 180th meridian; the issue does not name source files or tests. Reproduce the behavior by measuring across the meridian in both directions, then verify the magnetic variation remains consistent.

Written by the indexing model from the issue text.

Description

bug

Describe the bug
When using the Measure tool, if the start point is in the eastern hemisphere and the measure line is pulled to the western hemisphere, the magnetic variation is incorrectly calculated (added instead of subtracted, for example) when the line crosses the 180th meridian. This occurs whether going E to W or W to E.

To Reproduce
See above

Expected behavior
Variation should be consistent

Screenshots
See video. Watch the Magnetic direction change.

https://github.com/user-attachments/assets/9139bba4-998c-4c50-ae08-04a05cbcf70d

Desktop (please complete the following information if applicable):
Edition Windows 11 Home
Version 25H2
Installed on ‎10/‎17/‎2025
OS build 26200.8457

Dominant language
C
Stars
1.5k
Forks
627
Avg merge
1d 9m
Merged PRs (30d)
9

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from OpenCPN/OpenCPN

All issues in OpenCPN/OpenCPN

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.