problem in GetLocation();

nasirgul
04-21-2008, 03:31 PM
Hello,
I am having a problem while interfacing mine software with GPS Locater. I am getting Lat & Long in text box correctly with mine GPS Locator. But having problem with Lat & Long ... When I click button to find Map.Its give me error ...............at getlocation();

loc = axMappointControl1.ActiveMap.GetLocation(Lat,Long, Altitute);
Error is:
An unhandled exception of type 'System.FormatException' occurred in mscorlib.dll
Additional information: Input string was not in a correct format....


It is giving error as GetLocation(); accepts in double format. I tried this

string Lat;
string Lon;
/////as I am using some other string varaibles to get NMEA data...
txtLat.Text = Lat;
txtLon.Text = Lon;

double lat = Convert.ToDouble(this.txtLat.Text as string);

double lon = Convert.ToDouble(this.txtLong.Text as string);
Hope to hear from you guys.
Regards.
Nasir

Mattys Consulting
04-21-2008, 05:51 PM
Maybe you spelled Altitude wrong (Altitute)?

Mike Mattys

Wilfried
04-22-2008, 02:03 AM
Hi,

as I am using some other string varaibles to get NMEA data

Do you mean that you use Convert.ToDouble() to convert an NMEA formatted string to a double? NMEA format is not same as a double, it is (d)ddmm.fff(f)

nasirgul
04-22-2008, 05:23 AM
Hello,
Thanks actually I was adding NMEA "GPGGA" data and i converted all in string. But as getlocation(); accepts double format, so I removed N & W from the array of GPGGA and now it works fine. Thanks you vey much once again.................
Nasir

Wilfried
04-24-2008, 07:36 AM
Hi,

Just removing the N and W does not make it the right number. Nmea format for latitude is ddmm.fff(f) and for longitude dddmm.fff(f), where (d)dd is degrees, mm is minutes and fff(f) are the fractions of the minutes.

for example latitude: 5030.000 is 50.5 degree witch is what GetLocation wants.

nasirgul
04-24-2008, 08:13 AM
Hello,
Thanks. I already did this conversion from DMS to DD & I am getting mine exact location where I am.
Regards.
Nasir

 
Web mp2kmag.com
mapforums.com