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 "Elevation Correction doesn't work" #21691

Merged
merged 3 commits into from
Jan 16, 2025
Merged

Fix "Elevation Correction doesn't work" #21691

merged 3 commits into from
Jan 16, 2025

Conversation

nazar-kutz
Copy link
Contributor

@nazar-kutz nazar-kutz commented Jan 9, 2025

Fix Summary

This pull request addresses the issue described in #21418.

Problem Description

The issue occurred exclusively for tracks recorded manually via Trip Recording and did not affect tracks created with Plan Route or exported from navigation routes.

The root cause was point duplication in tracks, resulting in a mismatch between the number of points in GPX tracks and segments in the editing context. This problem is described in detail here and here.

Analysis and Fix

  • The duplication was traced back to code added over 8 years ago, which caused errors in elevation calculations.
  • All potential use cases for duplication were analyzed to ensure it was not intentional behavior. Findings revealed no beneficial use of duplication:
    • MeasurementToolLayer: Duplication had no effect on line rendering.
    • SaveGpxRouteAsyncTask: Duplication doubled the number of points in tracks during "simplified track" saving.
    • getSegmentsPoints: Duplication applied only if the number of points ≤ 2, a rare case.
    • calculateHeightmapTrack: This was where the issue described in the Issue originated.
  • An analysis of the code where duplication was first introduced link revealed no intended usage.

Testing

  • Key functions related to Plan Route and Snap to Road were tested. No new bugs were found after removing duplication.
  • Tested saving "simplified tracks" with 126 points. The number of points in the track now remains consistent after saving.
  • Videos showing the functionality before and after the fix are provided below.

Elevation correction

Before fix After fix
output_360x800_alt.mp4
output_360x800_video3.mp4
Chart data is the same before and after using "Elevation correction" feature. This demonstrates the corrected functionality after removing duplication.

Save as a new "simplified track"

Before fix After fix
output_360x800_video2.mp4
output_360x800_video4.mp4
The number of points increased after saving as "simplified track" from 126 to 250 (it displays in the header of the dialog). The number of points remains unchanged (126) after saving as a new "simplified track".

Outcome

The functions now work correctly after the changes, and the bug described in the Issue has been successfully resolved.

@nazar-kutz nazar-kutz changed the title Fix Elevation Correction doesn't work Fix "Elevation Correction doesn't work" Jan 9, 2025
@nazar-kutz nazar-kutz linked an issue Jan 9, 2025 that may be closed by this pull request
@Chumva Chumva requested a review from alex-osm January 9, 2025 20:49
@Chumva Chumva merged commit fa387f9 into master Jan 16, 2025
3 checks passed
@Chumva Chumva deleted the FixElevationCorrection branch January 16, 2025 08:38
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.

Elevation correction don't work
2 participants