Windows phone 7 Windows phone 8 gps/高度问题

Windows phone 7 Windows phone 8 gps/高度问题,windows-phone-7,gps,windows-phone-8,altitude,Windows Phone 7,Gps,Windows Phone 8,Altitude,更新:使用这里的示例-并添加高度读数,我得到了与代码相同的结果。准确度差的距离为50英尺。在720(正确)和300英尺之间来回移动意味着出了问题。我只是不知道在哪里 我开始为WindowsPhone8制作一个GPS跟踪应用程序,但有些事情正在失控。在我的应用程序(以及示例位置应用程序)中,我得到了一些正确的读数,而其他读数则不正确。通常,高度在~95和~215之间来回跳跃(215是正确的)。我得到的距离也非常不准确,坐在办公桌前或在外面走来走去时,很快跳到了几英里 我不确定要发布什么代码,因为它

更新:使用这里的示例-并添加高度读数,我得到了与代码相同的结果。准确度差的距离为50英尺。在720(正确)和300英尺之间来回移动意味着出了问题。我只是不知道在哪里

我开始为WindowsPhone8制作一个GPS跟踪应用程序,但有些事情正在失控。在我的应用程序(以及示例位置应用程序)中,我得到了一些正确的读数,而其他读数则不正确。通常,高度在~95和~215之间来回跳跃(215是正确的)。我得到的距离也非常不准确,坐在办公桌前或在外面走来走去时,很快跳到了几英里

我不确定要发布什么代码,因为它与示例代码相同。如果你认为还有其他相关的部分我应该张贴让我知道,我会添加它

    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;

        /*
        geolocator = new Geolocator();
        geolocator.DesiredAccuracy = PositionAccuracy.High;
        //geolocator.MovementThreshold = 1; // The units are meters.
        geolocator.ReportInterval = 1000;
        geolocator.StatusChanged += geolocator_StatusChanged;
        geolocator.PositionChanged += geolocator_PositionChanged;
         * 
         * */
        logging = true;

        startTime = DateTime.Now;


    }
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)";

            }


        });
    }

你可能也看到了不同的问题,但GPS高度不是很可靠。我有一些Garmin设备,它们到处乱跳。你真的需要一个气压计来保证高度的准确度。
这里有一个关于GPS姿态不准确性的链接

您可能也看到了不同的问题,但GPS高度不太可靠。我有一些Garmin设备,它们到处乱跳。你真的需要一个气压计来保证高度的准确度。
这里有一个关于GPS姿态不准确性的链接

我有同样的经验,但不是解决方案。我有同样的经验,但不是解决方案。
void geolocator_PositionChanged(Geolocator sender, PositionChangedEventArgs args)
    {
        System.Diagnostics.Debug.WriteLine(args.Position.Coordinate.Altitude.ToString());


        if (!App.RunningInBackground)
        {
            Dispatcher.BeginInvoke(() =>
            {
                LatitudeTextBlock.Text = args.Position.Coordinate.Latitude.ToString("0.00");
                LongitudeTextBlock.Text = args.Position.Coordinate.Longitude.ToString("0.00");

            });
        }
        else
        {
            Microsoft.Phone.Shell.ShellToast toast = new Microsoft.Phone.Shell.ShellToast();
            toast.Content = args.Position.Coordinate.Latitude.ToString("0.00");
            toast.Title = "Location: ";
            toast.NavigationUri = new Uri("/MainPage.xaml", UriKind.Relative);
            toast.Show();

        }
    }