none
GPS / altitude accuracy off / jumping around

    General discussion

  • I'm starting to make a GPS tracking app for windows phone 8 but something is going haywire. In my app, (and in the sample location app) i get some readings that are correct and others that are not. In general, the altitude jumps back and forth between ~95 and ~215 (with 215 being correct). The distance I'm getting is hugely inaccurate as well, quickly jumping to several miles while sitting at my desk or walking around outside. 

    I'm not sure what code to post, as it is identical to the sample code, but I'll post some of the relevant parts. 

    double maxSpeed = 0.0;
            double maxAlt = -9999999.0;
            double minAlt = 9999999.0;
            double curDistance = 0.0;
            GeoCoordinate lastCoord = null;

    protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e) { if ((bool)IsolatedStorageSettings.ApplicationSettings["LocationConsent"] != true) { // The user has opted out of Location. return; } if (App.Geolocator == null) { // Use the app's global Geolocator variable App.Geolocator = new Geolocator(); } App.Geolocator.DesiredAccuracy = PositionAccuracy.High; //App.Geolocator.MovementThreshold = 1; // The units are meters. App.Geolocator.ReportInterval = 1000; //App.Geolocator.DesiredAccuracyInMeters = 50; App.Geolocator.StatusChanged += geolocator_StatusChanged; App.Geolocator.PositionChanged += geolocator_PositionChanged; } public static GeoCoordinate ConvertGeocoordinate(Geocoordinate geocoordinate) { return new GeoCoordinate ( geocoordinate.Latitude, geocoordinate.Longitude, geocoordinate.Altitude ?? Double.NaN, geocoordinate.Accuracy, geocoordinate.AltitudeAccuracy ?? Double.NaN, geocoordinate.Speed ?? Double.NaN, geocoordinate.Heading ?? Double.NaN ); }


    void geolocator_PositionChanged(Geolocator sender, PositionChangedEventArgs args) { Dispatcher.BeginInvoke(() => { if (lastCoord == null) { lastCoord = ConvertGeocoordinate(args.Position.Coordinate); } DateTime currentTime = DateTime.Now; TimeSpan totalTime = currentTime - startTime; timeValue.Text = totalTime.ToString(@"hh\:mm\:ss"); System.Diagnostics.Debug.WriteLine(args.Position.Coordinate.Altitude.ToString()); GeoCoordinate thisLocation = ConvertGeocoordinate(args.Position.Coordinate); if (true) //units check true = standard { double speed = (double)thisLocation.Speed; speed *= 2.23694; //m/s -> mph speedValue.Text = speed.ToString("0"); double alt = (double)thisLocation.Altitude; if (alt > maxAlt) { maxAlt = alt; } if (alt < minAlt) { minAlt = alt; } /* double currentAlt = (maxAlt - minAlt); currentAlt *= 3.28084; //m -> ft * */ alt *= 3.28084; altValue.Text = alt.ToString("0"); double distance = thisLocation.GetDistanceTo(lastCoord); curDistance += distance; distance = curDistance * 0.000621371; // m -> miles distanceValue.Text = distance.ToString("0.00"); distanceUnits.Text = "(mi)"; speedUnits.Text = "(mph)"; altUnits.Text = "(ft)"; } else { double speed = (double)thisLocation.Speed; speed *= 3.6; //m/s -> kph speedValue.Text = speed.ToString("0"); double alt = (double)thisLocation.Altitude; if (alt > maxAlt) { maxAlt = alt; } if (alt < minAlt) { minAlt = alt; } double currentAlt = (maxAlt - minAlt); //for vert drop //currentAlt *= 3.28084; //m -> ft altValue.Text = alt.ToString("0"); double distance = thisLocation.GetDistanceTo(lastCoord); curDistance += distance; distance = curDistance * 0.001; // m -> km distanceValue.Text = distance.ToString("0.00"); distanceUnits.Text = "(km)"; speedUnits.Text = "(kph)"; altUnits.Text = "(m)"; }

    lastCoord = thisLocation; }); }




    • Edited by clarky07 Thursday, December 13, 2012 6:08 PM
    Tuesday, December 11, 2012 10:47 PM

All replies

  • I didn't mention, but the speed is perfectly fine as an fyi. the lat / long is pretty close in general to where i am, so I don't think it's a hardware issue.
    Tuesday, December 11, 2012 11:29 PM
  • Another note, I'm checking the horizontal and vertical accuracy. They are both fine, and improve the longer the program runs as you'd expect. I still get the spurious results though. Altitude jumps back and forth between the correct ~720 ft and ~300 feet. 
    Wednesday, December 12, 2012 4:32 PM
  • Have you tried fiddling with the positionaccuracy value? You have it high (obvious), but I'd be curious to know the delta in readings with different settings.

    Also, did you check:

    http://msdn.microsoft.com/en-us/library/windows/apps/windows.devices.geolocation.geocoordinatesatellitedata.verticaldilutionofprecision.aspx?

    Wednesday, December 12, 2012 5:53 PM
  • I have. There is only 1 other setting for positionaccuracy and that is "Default". It is the low power mode and I only get a reading once every 30 seconds or so. It didn't give better results either.

    I've checked both hdop and pdop, and they suggest that i'm getting good data, even though i'm not. 

    I've also tested other apps in the store, and they work fine so I'm confident it isn't a hardware problem. So bizarre that the sample app is giving broken results....Note that I don't know if any of the apps i tried were built using windows 8 or anything similar to this code. I assume they are using the old 7.x versions.

    Wednesday, December 12, 2012 6:34 PM
  • Update, when stopping in the debugger to check the value instead of just printing it, it gives this:

    Altitude = An internal error has occurred while evaluating method Windows.Devices.Geolocation.Geocoordinate.get_Altitude()

    I tried to search for this, but the error is nowhere to be found on the internet...

    The documentation states that altitude and a few others aren't guaranteed, but it also says that the value will be null if it isn't there. I check, and it's never null. It always prints a value, either correct or ~400 ft off. 


    Wednesday, December 12, 2012 8:01 PM
  • Its a shame I am not seeing an obvious way for you to check how many sat locks you are getting in your location. This would be to eliminate a bad dev location as the culprit. What city are you in?

    You know that altitude from GPS is not accurate and can vary in accuracy depending on geolocation?

    Its interesting that you have tested other apps and they work fine. Fine means they are reporting an altitude that is what you expect and they do this consistently?

    Are you always debugging when you are doing your readings or are you taking your app on the phone outside and simulating more or less a "normal" user experience?

    Thursday, December 13, 2012 3:17 PM
  • As far as I know sat locks aren't reported, I do have checks for both horizontal and vertical accuracy as well as hdop and pdop. They are all fine, and improve just as would be expected the longer the app is running. There is no difference whatsoever in these between the correct readings and the incorrect ones. Just a note, I've spent the last 4 years working with gps on consumer electronics devices, iphone apps, android apps, and windows 7 apps. I've got a pretty good idea of what they can and can't do as well as what is normal in my area.

    As noted, altitude is not very accurate, and for me (near Nashville TN) that means it will jump in the range of 675 - 725 ft, rarely outside of that. What I am seeing is reporting ~700 and then 300 and then back to 700. This is very bizarre.

    I've tested a few other apps on the store, and they are mixed. Of the 2 I tested today, 1 works fine, i.e. several minutes and it never reports an altitude below 700. The other I thought was fine, but it did eventually report a couple 300 readings. Not as frequent as mine, but it was there....

    I've also been taking the phone outside for testing. Interesting, I've been trying to move on as well as figure this out so I don't go crazy, and I just finished the mapping part. Mapping it shows that the results (at least lat/long) are actually very good. Down to which side of the road I am on. I had been assuming up until this point that the data points with the incorrect altitude would be off quite a bit because of the distance I was seeing.

    I took a walk around my neighborhood (really short, roughly .1 miles according to iPhone) and the trace on the map was perfect, but my distance said > 4 miles. This is in addition to the altitude jumping back and forth. Maybe this is key as to what is going on?

    Thursday, December 13, 2012 4:27 PM
  • Note that I have the same thing happen using the windows 8 location sample with only adding an altitude readout. (i'd post a link but it won't let me...)
    Thursday, December 13, 2012 4:30 PM
  • Sounds like you have far more experience with GPS than I.

    I saw a few posts online where some developers are averaging multiple altitude readings within a period of time distance to compensate for the accuracy issues. If a person was only getting 1 in 5 readings that were out of range it could be easy to filter them out.

    It would be interesting to log readings moving along the same path with different reading intervals. Without knowing exactly how the underlying driver is working the idea would be to test around it it. I wonder things like if pushing shorter intervals reduces accuracy of altitude.

    Was that distance test on the WP? How are you getting distance?

    Thursday, December 13, 2012 4:57 PM
  • Disregard. Distance fixed. see below

    Yeah the distance was using a WP.

    from the code above, using GeoCoordinate.GetDistanceTo

    double distance = thisLocation.GetDistanceTo(lastCoord);
    
    curDistance += distance;
    
    distance = curDistance * 0.000621371; // m -> miles
    
    distanceValue.Text = distance.ToString("0.00");

    Is it possible I'm having a problem with the conversion from Geocoordinate to GeoCoordinate?

    Note that speed has been good to. So speed, lat, long, are very good. GetDistanceTo and altitude are broken for me....


    • Edited by clarky07 Thursday, December 13, 2012 6:06 PM
    Thursday, December 13, 2012 5:06 PM
  • Just downloaded 5 more apps, all of them are giving me the wrong altitude (all switching back and forth between correct and way off), so I decided to test the "working" app more thoroughly. After a much longer test, it still works. I don't think it's a problem with the hardware, but something with the sample that I'm missing. It also seems that a lot of other people are using the sample with blind faith, or lax QA :-)


    Thursday, December 13, 2012 5:46 PM
  • Distance was a silly error. I wasn't resetting lastCoord at the end so each distance was going from initial point. 

    Altitude is still off though, and is off in most apps I've tried except the 1.

    Thursday, December 13, 2012 6:07 PM
  • Hello,

    Can you please tell us the name of the "working" app you found?

    I also get wrong altitudes with my HTC 8x (the same code was OK on Windows Phone 7).

    Maybe the developers of the working app have implemented a filter for the bad altitudes and simply ignore them?

    Alex.



    • Edited by _ Alex Thursday, December 13, 2012 6:29 PM
    Thursday, December 13, 2012 6:29 PM
  • Runtastic. Good to see I'm not the only one with this issue anyways. I'm using the HTC 8x as well btw.
    Thursday, December 13, 2012 6:30 PM
  • Hi,

    I come back on the subject.

    Is anyone from Microsoft in contact with HTC to raise/confirm the problem? Many of my users with HTC 8s and 8x complain about these sudden changes in altitude.

    Thank you,

    Alex

    Tuesday, March 26, 2013 6:25 PM
  • Hei,

    Runtastic tracks routes also with altitude errors, but it tries to correct them afterwards.
    For me, it looks like a windowsphone error.

    I tried now Endomondo, Runtastic and Run the map. Always the same altitude problems. :-/

    greetings,

    jn

    Thursday, April 18, 2013 8:39 PM
  • Hello,

    I have also this problem with the Nokia Lumia 620. In my city it jumps from the right 140 m down to 22 m. Hopefully it will be fixed by Microsoft soon.

    I found this request on WP Dev Platform (wpdev.uservoice.com):

    Fix Altitude Bug in GeoCoordinateWatcher and Geolocator when using in WP8

    Ray Krebs mentioned that he can fix this with:  ... take the Geolocator class an set the DesiredAccuracyInMeters = 1; (Yes set to 1), then the altitude never jumps anymore!

    Could anyone test this?

    May it helps than more people vote for this improvement of WP8.

    Regards,

    Simon

    Friday, June 21, 2013 8:52 PM
  • I've just bought a Nokia Lumia 520 which is exhibiting this problem. I first noticed it when Endomondo sports tracker showed that I had done 27,000 feet of ascent and descent while walking the dog. Everest here I come!

    I tried a variety of trackers: Sports Tracker and Run the Map, and GPS Satellite, GPSInfo, GPS Toolkit. All showed the altitude jumping about from c. 210 m (actual height) down to 27 m. I returned the phone as I assumed a hardware fault but the replacement shows the same behaviour. I'm glad to see that this is a known issue. I was puzzled that I couldn't find any mention of it until I found this thread.

    Will try Runtastic to see if that is any better. Would be happy to test anything out for anyone writing code to defeat this monster!

    Leila

    Monday, July 29, 2013 11:00 PM