3

i am using GPS to calculate distance between two points i.e. i am using windows phone as a tape measure but when i start i dont get the correct value infact even if i am standing still it gives me hundreds of meter

here is my code

      myWatcher.StatusChanged += new EventHandler<GeoPositionStatusChangedEventArgs>(myWatcher_StatusChanged);
        myWatcher.PositionChanged += new EventHandler<GeoPositionChangedEventArgs<GeoCoordinate>>(myWatcher_PositionChanged);
        myWatcher.MovementThreshold = 1;   

void myWatcher_PositionChanged(object sender, GeoPositionChangedEventArgs<GeoCoordinate> e)
    {
        double tempf = e.Position.Location.Latitude;
        double temps = e.Position.Location.Longitude;
        if (count2 == 0)
        {
            FirstLocation = new GeoCoordinate(tempf, temps);
            count2++;
        }
        else
        {
             double distanceInMeter;
            GeoCoordinate currentLocation;
                currentLocation = new GeoCoordinate(tempf, temps);
                distanceInMeter = currentLocation.GetDistanceTo(FirstLocation);                   

                if (App.flag == 0)
                {
                    textBlock1.Text = distanceInMeter.ToString() + " m";
                    double distanceInCm = distanceInMeter * 100;
                    textBlock2.Text = distanceInCm .ToString() + " cm";
                }
                else if (App.flag == 1)
                {
                    double distanceInInch = distanceInMeter * 39.3701;
                    textBlock1.Text = distanceInInch.ToString() + " in";
                    double distanceInFoot = distanceInMeter * 3.28084;
                    textBlock2.Text = distanceInFoot.ToString() + " ft";
                }
        }

    }
Hamza
  • 1,593
  • 2
  • 19
  • 31
  • as a tape measure? gps is only accurate to around 8 meters in the *best case*. if you are getting tower assisted gps instead of true gps, 100's of meters is probably best case. – John Gardner Dec 11 '12 at 18:13
  • so far accuracy is not an issue. i run this app and the reading at current location changes continuously while i have set movementthreshold to 1 means 1 meter of distance needs to be covered to call PositionChanged event but reading keeps on changing even though i am still – Hamza Dec 11 '12 at 19:24
  • 1
    how can you say "accuracy is not an issue" if your entire question is about accuracy? if any individual measurement of GPS is only good to within (at best!) 3 meters, any 2 measurements from the *exact same place* could be (at best!) 6 meters apart! again, **at best**. gps is best for measuring distances on the *planet*, not on a *piece of paper*. – John Gardner Dec 11 '12 at 19:32
  • no thats not what i meant its just that reight now i have not reached to accurate measurement phase and i know 3 - 4 meters is accuracy and i'll make the app for that but the current issue is that even if i am standing still i get hundreds of meter of distance although it is inacurate but it should give almost 0 at the current location. see my code above – Hamza Dec 12 '12 at 03:56
  • did you actually look at the 2 coords you get from your 2 "standing still" calls? did you plug them into a map to see what you got? did you calculate the distance between those calls some other way not using this call? Like I've been saying, any 2 calls could give you 2 answers. the first call might get you tower assisted coords, which are very innacurate. the second call might get a proper gps fix, giving you a more precise answer, which is different than the first! – John Gardner Dec 12 '12 at 17:49

3 Answers3

1

At best, a GPS is only accurate to 3 meters. The more likely error is 5 - 10 meters.

You're going to have to augment your GPS readings to get better accuracy.

Gilbert Le Blanc
  • 50,182
  • 6
  • 67
  • 111
  • The GPS Standard Positioning Service (which is all you got unless you've got special military hardware), at best offers +/- 7.8 meters in 3 dimensions at a 95% confidence level. That's a sphere of uncertainty 52 feet in diameter. You can read the current edition of the standard at http://www.gps.gov/technical/ps/. That's the best case. There are many other sources of entropy that reduce the precision of the solution, including hardware/software issues on the part of the GPS receiver, atmospheric and other external factors, etc. – Nicholas Carey Dec 11 '12 at 18:25
1

so far accuracy is not an issue. i run this app and the reading at current location changes continuously while i have set movementthreshold to 1 means 1 meter of distance needs to be covered to call PositionChanged event but reading keeps on changing even though i am still

Hamza
  • 1,593
  • 2
  • 19
  • 31
0

The other posters here are generally correct: GPS will not give you the accuracy you need. At least not alone!

Assuming you did have a good satellite fix, you could get an accuracy of centimeters, but this would require post-processing with information from special fixed stations or a live feed of data from such a station. The buzzwords here are "real-time phase differential", "real-time kinematic", "phase-differential post-processing".

This site has some details.

So, if you can get access to feed, it may be possible. But it will not be as easy as you probably hoped.

Richard
  • 56,349
  • 34
  • 180
  • 251