Skip to content

Commit

Permalink
Write OSMTracker headings as having a magnetic reference
Browse files Browse the repository at this point in the history
The compass values it writes comes from the on-board magnetic compass.
  • Loading branch information
dfandrich committed Jan 29, 2024
1 parent db2e332 commit 1bce11e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions gpx-read.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ static void ExtractTrackPoints(xmlNodePtr Start)
const char* Elev;
const char* Time;
const char* Heading;
char HeadingRef = 'T';

for (Current = Start; Current; Current = Current->next)
{
Expand Down Expand Up @@ -129,6 +130,7 @@ static void ExtractTrackPoints(xmlNodePtr Start)
if (Extensions->children)
{
Heading = (const char *)Extensions->children->content;
HeadingRef = 'M'; /* This comes from the compass */
break;
}

Expand Down Expand Up @@ -204,6 +206,7 @@ static void ExtractTrackPoints(xmlNodePtr Start)
}
if (Heading) {
LastPoint->MoveHeading = atof(Heading);
LastPoint->HeadingRef = HeadingRef;
}
LastPoint->Time = ConvertToUnixTime(Time, GPX_DATE_FORMAT, 0, 0);

Expand Down
4 changes: 2 additions & 2 deletions tests/data/test169.result
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ Failed: 0 (0 Not matched, 0 Write failure, 0 Too Far,
0x0005 GPSInfo GPSAltitudeRef Byte 1 1
0x0006 GPSInfo GPSAltitude Rational 1 420671/1000
0x0007 GPSInfo GPSTimeStamp Rational 3 12/1 35/1 20/1
0x000e GPSInfo GPSTrackRef Ascii 2 T
0x000e GPSInfo GPSTrackRef Ascii 2 M
0x000f GPSInfo GPSTrack Rational 1 315/1
0x0010 GPSInfo GPSImgDirectionRef Ascii 2 T
0x0010 GPSInfo GPSImgDirectionRef Ascii 2 M
0x0011 GPSInfo GPSImgDirection Rational 1 355/1
0x0012 GPSInfo GPSMapDatum Ascii 7 WGS-84
0x001d GPSInfo GPSDateStamp Ascii 11 2012:11:22

0 comments on commit 1bce11e

Please sign in to comment.