Problems with parsing coordinates via Position.parse()

I have problem with parsing coordinates on Vivoactive.
When I try to parse either such coordinates "N 30.549783 W 97.618417" or "N 30.549783 W 097.618417", the longitude became 0.00000. (Fenix 3 parses both variants without any problems)
What is the correct format of coordinates on Vivoactive? Or this is some ConnectIQ bug.

Thanks
  • I haven't tested, but I'd expect the system be able to round-trip a coordinate (Pos.Location -> Lang.String -> Pos.Location) using the Location.toGeoString() and Position.parse() functions. The following test (if it compiles), should verify that.

    (:test)
    function test_position_round_trip(logger) {

    var coordinates = [
    [ 44.564566, -123.262044 ], // Corvallis, OR
    [ 38.881396, -94.819128 ] // Olathe, KS
    ];

    var formats = [
    Pos.GEO_DEG,
    Pos.GEO_DM,
    Pos.GEO_DMS,
    Pos.GEO_MGRS
    ];

    for (var i = 0; i < coordinates.size(); ++i) {
    var coordinate = coordinates;
    logger.debug(Lang.format("Testing [ $1$, $2$ ]", coordinate));

    var old_loc = new Pos.Location({
    :latitude => coordinate[0],
    :longitude => coordinate[1],
    :format => :degrees
    });

    for (var j = 0; j < formats.size(); ++j) {
    var format = formats;

    // convert to a string representation
    var s = old_loc.toGeoString(format);
    logger.debug(Lang.format(" Format $1$: $2$", [ format, s ]));

    // parse the string representation
    var new_loc = Pos.parse(s, format);
    Test.assertMessage(new_loc != null, "Expected non-null value");
    Test.assertEqual(new_loc, old_loc);

    // you might have to do something like this to test if location comparisons aren't working
    // as expected...
    //var t = new_loc.toGeoString(format);
    //Test.assertEqual(s, t);
    }
    }
    }
    [/code]

    Travis
  • I tried different ways. In emulator it works, but on real device not (Vivoactive).
    Pos.GEO_DEG returns string as "N 44.564568î‚°W123.262047î‚°"

    So to summarize:
    Latitude it parses successfully in any case.
    Longitude parse works only when there is 1-digit (e.g. E 5.999). I thought it's should be right-aligned (E120.0; E 20.0; E 2.0), but this doesn't work as well.
    So I tried next formats:
    N 10.00000 E 020.00000 not work
    N 10.00000 E 20.00000 not work
    N 10.00000 E 20.00000 not work
    N 10.00000° E 20.00000° not work
    N 10.00000 E 2.00000 work
    N 10.00000 E120.00000 not work
  • Found solution which works on Vivoactive: N30.549783,W97.618417
    But it recognizes it as east hemisphere. (N30.549783,E97.618417)
    In emulator everything works well.
    This is some bug.