This project is read-only.

Invalid Position

Oct 26, 2009 at 8:07 PM
Sorry, I was wrong and I have put the message in the Issue Tracker section. Sorry for the error.
When a PositionChanged event:
First Event: valid position (Latitude and Longitude OK and e.Position.IsInvalid == false).
Second Event: invalid position (e.Position.IsInvalid == true) and Latitude and Longitude = NaN
Third: valid position
Fourth: invalid position...
...And so on

When the position is not valid, appears at the output of the debugger: A first chance exception of type 'System.FormatException' occurred in mscorlib.dll


This is my code:
...
nmeaInterpreter1 = new GeoFramework.Gps.Nmea.NmeaInterpreter();

// EventHandlers of GPS
Devices.DeviceDetectionCompleted += new EventHandler(Devices_DeviceDetectionCompleted);
nmeaInterpreter1.PositionChanged += new EventHandler<PositionEventArgs>(nmeaInterpreter1_PositionChanged);
nmeaInterpreter1.FixQualityChanged += new EventHandler<FixQualityEventArgs>(nmeaInterpreter1_FixQualityChanged);

// Detect GPS
GeoFramework.Gps.IO.Devices.BeginDetection();
...

private void Devices_DeviceDetectionCompleted(object sender, EventArgs e)
{
nmeaInterpreter1.Start();
}

private void nmeaInterpreter1_PositionChanged(object sender, PositionEventArgs e)
{
BeginInvoke(new MethodInvoker(delegate()
{
//if (e.Position.IsInvalid == false)
//{
txtLatitude.Text = e.Position.Latitude.DecimalDegrees.ToString();
txtLongitude.Text = e.Position.Longitude.DecimalDegrees.ToString();
//}
}));
}

I use a Toshiba Portege with WM6.1 and CF3.5.
Is a mistake or I do something wrong?
Thanks.
Oct 28, 2009 at 7:25 PM

Solved.

I change the regional settings of my smartphone to English(U.S.A).

Originally was set to Spanish, and I think it was a problem with the decimal comma conversion.
Take this opportunity to congratulate the author/s of the project. It is an excellent project.
Congratulations and thanks for sharing it with us.
Best regards,
Luis
Oct 28, 2009 at 10:05 PM
Another thing I did was change the property:

nmeaInterpreter1.IsFilterEnabled = false;
If the property is true, there are still some errors in positioning (latitude and longitude = NaN).