Weird FIT data and how to filter it

I am looking at my activity data for a data field I am writing.
Running the FIT file through the simulator, gives me some weird data.
I am not sure if it is an actual GPS issues (I am in the water while recording the activity) or if it is a simulator issue.

Two things are unclear.
- info.elapsedDistance jumps thousands of meters
- lat and lon go to 180.000000 and speed to 0.000000
Here a sample. This is sequential, reading every second trough compute():

Speed = 0.000000 and Dist = 39.939667
17.841495 and -101.769442
Speed = 5.643202 and Dist = 40.323082
17.841487 and -101.769498
Speed = 7.020412 and Dist = 42.246140
17.841488 and -101.769535
Speed = 7.557860 and Dist = 43.721672
180.000000 and 180.000000
Speed = 0.000000 and Dist = 45.430229
180.000000 and 180.000000
Speed = 0.000000 and Dist = 2819874.750000
180.000000 and 180.000000
Speed = 0.000000 and Dist = 2819874.750000
180.000000 and 180.000000
Speed = 0.000000 and Dist = 2819874.750000


Is this normal?
Assuming it is, I am trying to eliminate the condition of lat (and lon) and 180.000000
My coding skills are lacking here. Can't seem to create an if situation where it works.

I tried all these, none seems to work:
if(info.currentLocation != null){
var temp = info.currentLocation.toDegrees()[0];
if (temp < 180){
Sys.println("Testing if");
lat = info.currentLocation.toDegrees()[0];
lon = info.currentLocation.toDegrees()[1];
}
}


I also tried:

if (temp != 180.000000)

if (temp != "180.000000")

if (temp < 180.000000)

And then I tried :

if(info.currentLocation != null){
lat = info.currentLocation.toDegrees()[0];
lon = info.currentLocation.toDegrees()[1];
}

if (lat != 180.000000)
if (lat != "180.000000")
if (lat < 180.000000)
if (lat < 180)



None seems to work.
  • In the sim, the lat/lon you see is a loss of GPS in the recorded .fit. I played back a .fit I got from a friend in south africa, and when he went in a tunnel, I had him far above the north pole in my breadcrumb trail, but he returned to South Africa when he came out of the tunnel!!

    In the sim, just ignore that 180/180, but for the real app on a device, be sure to use the quality/accuracy of a location to see if it's valid or not before you use it!.
  • Thanks. No need to filter it out values, then.
    is the Sim issue also the reason why my if conditions were not working? Just wondering.
  • Here's the actual code I use to stop Hermo from dashing to the north pole and back. Some of the tests for neg numbers may not be needed, but included them anyway
    //this is for bad gps data in the sim
    if(latLon[0]<=90 && latLon[0]>=-90 && latLon[1]!=180 && latLon[1]!=-180) {


    it could be things you get from Activity.Info could be affected by these values. I don't know, as I was just using the GPS data to draw breadcrumbs at the time.
  • function type_name(type) {
    if (type == null) {
    return null;
    }
    if (type instanceof Lang.Number) {
    return "number";
    } else if (type instanceof Lang.Float) {
    return "float";
    } else if (type instanceof Lang.Long) {
    return "long";
    } else if (type instanceof Lang.Double) {
    return "double";
    } else if (type instanceof Lang.Char) {
    return "char";
    } else if (type instanceof Lang.Boolean) {
    return "boolean";
    } else if (type instanceof Lang.Array) {
    return "array";
    } else if (type instanceof Lang.Dictionary) {
    return "dict";
    } else if (type instanceof Lang.String) {
    return "string";
    } else if (type instanceof Lang.ByteArray) {
    return "byte array";
    }

    return null;
    }

    function compute(info) {
    if (info.currentLocation != null) {
    var temp = info.currentLocation.toDegrees()[0];
    if (temp < 180) {
    var lat = info.currentLocation.toDegrees()[0];
    var lon = info.currentLocation.toDegrees()[1];

    System.println(Lang.format("$1$ ($2$), $3$ ($4$)", [ lat, type_name(lat), lon, type_name(lon) ]));
    }
    }
    }


    I can't reproduce the lat/lon issue here. The above prints this in the simulator.

    38.895520 (double), -94.761923 (double)
    38.895543 (double), -94.761929 (double)
    38.895568 (double), -94.761935 (double)
    38.895585 (double), -94.761953 (double)
    38.895605 (double), -94.761970 (double)
    38.895622 (double), -94.761985 (double)
    38.895625 (double), -94.762009 (double)
    38.895629 (double), -94.762034 (double)
    38.895626 (double), -94.762058 (double)