cpfair / tapiriik

tapiriik keeps your fitness in sync
https://tapiriik.com
Apache License 2.0
1.71k stars 293 forks source link

Sanity Error - Why can't Lat or Lon = 0? #18

Open dhaughs opened 10 years ago

dhaughs commented 10 years ago

I was investigating an issue on some of my data that won't sync and I found the following piece of code in the sanity check:

if wp.Location: if wp.Location.Latitude == 0 and wp.Location.Longitude == 0: raise ValueError("Invalid lat/lng")

What's the reason behind this? Does one of the programs not support this? I know Garmin and Runkeeper are ok with it.

I realize that most likely no one is running at 0,0. However, we have an app that parses the data from iFit to a TCX file. Since this is treadmill data, we create a virtual running path to make runkeeper happy. Without a lot of complicated math it was easiest to create this run along the equator. So any of my runs on my treadmill will report a straight line run starting at 0,0. It's not perfect and it loses any elevation changes since Runkeeper likes to calculate all the stats itself based on lat,lon but it at least syncs the data. Since it's in the middle of the ocean I know it's a treadmill run and if I want the elevation profile I can look at Garmin or iFit.

I'm hoping soon to contribute to your project with the iFit API.

cpfair commented 10 years ago

Most probably there was some app that recorded points at 0,0 when the activity didn't have GPS data/no GPS fix was possible/etc. So, I added that in to make sure the faulty data never synchronized. Given that 0,0 is somewhat removed from the coast of Ghana, the risk of a real, properly-recorded activity having those coordinates is negligible.

I'd say the best way to fix this would be to stop creating false GPS tracks, and instead push the activities direct to RK via their API (which has full support for non-GPS activities like this). That, or ask RK to allow for TCX uploads without GPS data (I've never tried this - I assume you did).

dhaughs commented 10 years ago

Gotcha! The app just creates a TCX file. Runkeeper doesn't like a TCX file without GPS data. Since this started as a desktop app that was the immediate fix. I found Tapiriik as I was looking into the garmin API. Long term this is what I want to get to. I'll do some more looking at the source code and start planning iFit integration.

Thanks for the explanation.

Sent via carrier pigeons

On Apr 1, 2014, at 4:44 PM, Collin notifications@github.com wrote:

Most probably there was some API at some point in time that returned points at 0,0 when the activity didn't have GPS data. So, I added that in to make sure the faulty data never synchronized. Given that 0,0 is somewhat removed from the coast of Ghana, the risk of a real, properly-recorded activity having those coordinates is negligible.

I'd say the best way to fix this would be to stop creating false GPS tracks, and instead push the activities direct to RK via their API (which has full support for non-GPS activities like this).

— Reply to this email directly or view it on GitHub.

dhaughs commented 10 years ago

Looks like there is a catch 22 here in trying to make Tapiriik sync my "created" Garmin activities to Runkeeper. The sanity error also compares the "stationary" flag to number of waypoints if it's not a stationary activity. But it looks like pulling the data from Garmin any running data is going to be flagged as NOT stationary. So from what I can tell, Garmin to Runkeeper or anything else will not work if there is no GPS track.

Or its something else in the sanity check. Not sure. Guess I need to run it locally so I can debug.

The end solution is probably create an iFit module in Tapiriik to pull the data straight from iFit and flag it as stationary with no GPS data and push it to the associated sites.

I'll need to think on this some more. I really need to dive in and understand Tapiriik and learn python to see if I can even do this. But first I need to get it running locally properly.

cpfair commented 10 years ago

Garmin -> $other_service works fine without a GPS track in my testing - so there must be something new with your activities that it isn't accounting for.

I agree with you on having a dedicated iFit module - it'll give you the control you need to get the activities represented exactly the way they should be.

dhaughs commented 10 years ago

Agreed. Step 1) get Tapiriik running locally to debug ;)

Sent via carrier pigeons

On Apr 9, 2014, at 2:51 PM, Collin notifications@github.com wrote:

Garmin -> $other_service works fine without a GPS track in my testing - so there must be something new with your activities that it isn't accounting for.

I agree with you on having a dedicated iFit module - it'll give you the control you need to get the activities represented exactly the way they should be.

— Reply to this email directly or view it on GitHub.

cpfair commented 10 years ago

Are you having specific issues with that? Feel free to email me contact@tapiriik.com with them if you do.

dhaughs commented 10 years ago

I was. I'll play with it again and see if it's still fighting me. I ran out of time last time I tried to get it working. I'll keep you posted.

On Wed, Apr 9, 2014 at 3:21 PM, Collin notifications@github.com wrote:

Are you having specific issues with that? Feel free to email me contact@tapiriik.com with them if you do.

— Reply to this email directly or view it on GitHubhttps://github.com/cpfair/tapiriik/issues/18#issuecomment-40005432 .