diff --git a/src/Fit2TcxConverter.cpp b/src/Fit2TcxConverter.cpp index 4097397..3698b90 100644 --- a/src/Fit2TcxConverter.cpp +++ b/src/Fit2TcxConverter.cpp @@ -111,15 +111,20 @@ void Fit2TcxConverter::handle_Record(FitMsg_Record *record) { string timeId = GpsFunctions::print_dtime(record->getTimestamp()); - stringstream lat; - lat.precision(10); // default 4 decimal chars which is not enough - stringstream lon; - lon.precision(10); // default 4 decimal chars which is not enough - lat << SEMI2DEG(record->getPositionLat()); - lon << SEMI2DEG(record->getPositionLong()); - - TcxTrackpoint * point = new TcxTrackpoint(timeId, lat.str(), lon.str()); - *(tcxTrack) << point; + TcxTrackpoint * point; + if ((record->getPositionLat() != FIT_POSITION_INVALID) && (record->getPositionLong() != FIT_POSITION_INVALID)) { + stringstream lat; + lat.precision(10); // default 4 decimal chars which is not enough + stringstream lon; + lon.precision(10); // default 4 decimal chars which is not enough + lat << SEMI2DEG(record->getPositionLat()); + lon << SEMI2DEG(record->getPositionLong()); + point = new TcxTrackpoint(timeId, lat.str(), lon.str()); + } else { + point = new TcxTrackpoint(timeId); + } + + *(tcxTrack) << point; trackpointList.push_back(point); stringstream ss; diff --git a/src/fit/fitDefines.hpp b/src/fit/fitDefines.hpp index 99f2709..8ab7b56 100644 --- a/src/fit/fitDefines.hpp +++ b/src/fit/fitDefines.hpp @@ -37,6 +37,7 @@ enum FIT_SPORT { }; #define FIT_ENUM_INVALID (0xFF) +#define FIT_POSITION_INVALID ((signed long)0x7FFFFFFF) enum FIT_LAP_INTENSITY { INTENSITY_ACTIVE=0,