dtcooper / python-fitparse

Python library to parse ANT/Garmin .FIT files

Home Page:http://pythonhosted.org/fitparse/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Wrong position data

moppi79 opened this issue · comments

commented

hi,
become wrong position data from my Forrunner 235 Fit data,the date should be 50.1464~ ,9.0296~
i think it is, be a Wrong struct endian in the deeper code

{'timestamp': datetime.datetime(2020, 5, 22, 8, 15, 57), 'position_lat': 598290819, 'position_long': 107670058, 'distance': 0.67, 'enhanced_altitude': 126.60000000000002, 'altitude': 3133, 'enhanced_speed': 0.457, 'speed': 457, 'unknown_88': 300, 'heart_rate': 65}

Greetings :)

Hi,

The problem that you have is due to the used unit. The 'position_lat' and 'position_long' is given in semicircles. This should be converted, see link for details. Conversion can be done by: degrees = semicircles * ( 180 / 2^31 )

@theheek is correct. When using the library, the data is given back in the units it is recorded in the file (semicircles for lat+lon).

To get more standard units from the library, a data_processor can be used. A data processor that converts semicircles to degrees (among other things) is included in the library. To use it, provide an instance of it to the FitFile constructor like so:

fitfile = fitparse.FitFile(
    "path/to/your/file.fit"
    data_processor=fitparse.StandardUnitsDataProcessor(),
)

Please reopen if you're still not seeing correct values when using the data processor.