[Gpsbabel-code] NMEA file makes gpsbabel crash
GPSBabel converts and transfers data like waypoints, tracks & routes.
Brought to you by:
robertl
|
From: Albin D. <alb...@ho...> - 2011-07-27 08:30:00
|
Hi
I mainly use GPSBabel to convert "NMEA 0183 sentences" to "Google Earth
(Keyhole) Markup Language". I use WinXP.
My NMEA files can sometimes be quite big, over 100 MB. The application
works great, but on some files I get an error where the converter failes
and Windows gives the message: "GPS format converter has encountered a
problem and needs to close."
The status window reports:
gpsbabel -w -t -i nmea -f D:/Bad NMEA.txt -o
kml,lines,points,trackdata,labels -F D:/Bad NMEA.kml
Error running gpsbabel: Process crashed whle running
I'm fairly sure that this is due to some trash in the NMEA file which
looks like this:
$GPGGA,064535.000,5742.6491,N,01159.6726,E,1,8,1.01,-28.2,M,40.1,M,,*42
$GPGSA,A,3,26,07,28,08,06,10,05,19,,,,,1.30,1.01,0.82*01
$GPGSV,3,1,12,08,78,119,18,05,59,235,21,07,52,071,18,26,44,279,24*70
$GPGSV,3,2,12,10,27,171,18,28,25,157,27,03,12,033,,21,12,335,*7F
$GPGSV,3,3,12,06,10,019,25,15,10,284,,13,07,102,,19,07,062,20*76
$GPRMC,064535.000,A,5742.6491,N,01159.6726,E,0.69,229.34,250711,,,A*69
$GPGG$PMTK101*32
A,064536.000,5742.6487,N,01159.6719,E,1,8,1.01,-29.3,M,40.1,M,,*4A
$GPGSA,A,3,26,07,28,08,06,10,05,19,,,,,1.30,1.01,0.82*01
$GPGSV,3,1,12,08,78,118,18,05,59,235,2$PMTK011,MTKGPS*08
$PMTK010,001*2E
$GPGGA,064536.698,,,,,0,0,,,M,,M,,*4D
$GPGSA,A,1,,,,,,,,,,,,,,,*1E
$GPGSV,3,1,12,08,78,118,,05,59,235,,07,52,071,,26,44,279,*74
$GPGSV,3,2,12,10,26,171,,28,25,157,,03,12,033,,21,12,335,*72
$GPGSV,3,3,12,06,10,019,,15,10,284,,13,07,103,,19,07,061,*71
$GPRMC,064536.698,V,,,,,0.00,0.00,250711,,,N*48
The strange thing is that I haven't seen this error on smaller files, so
converting the example above will work. What I've done so far is that
I've run a simple script that throws away all rows which doesn't seem to
be a ordinary NMEA sentence. The script is very simple:
if( netlistrow.startsWith("$") && \
( (netlistrow.at(netlistrow.size()-1) >= '0' &&
netlistrow.at(netlistrow.size()-1) <= '9') || \
(netlistrow.at(netlistrow.size()-1) >= 'A' &&
netlistrow.at(netlistrow.size()-1) <= 'F') ) && \
netlistrow.at(netlistrow.size()-2) >= '0' &&
netlistrow.at(netlistrow.size()-2) <= '9' && \
netlistrow.at(netlistrow.size()-3) == '*' && \
!netlistrow.contains("$P") )
{
netlistclean.append(netlistrow);
}
An example of a file which makes gpsbabel crash can be found at:
http://www.hostmobility.org/Bad_NMEA.zip
I can live with this since I have the script, but I would very much
appreciate if gpsbabel were able to handle files like this without
cleaning them first. I would try to fix this myself, but I'm really not
a programmer and you would probably laugh at my code and not approve it.
Thanks for a great application!
Kind regards
Albin
|