Reformat GPS strings for Google Earth KML files
Paul_H
Posts: 85
Happy Friday All,
I'd like to build a routine to log NMEA GPS data into a Google Earth compatible KML file. This requires a reformat of the input String from GPS_mini
I wrote this routine to write a byte at a time to the SD card with no success. Is it failing because there are no terminating Nulls on each character? Not sure how to correct that... I have been reading up on the FORMAT sprintf() command, but again am not sure if this is going in the right direction.
As always any help or suggestions are appreciated!
Paul
I'd like to build a routine to log NMEA GPS data into a Google Earth compatible KML file. This requires a reformat of the input String from GPS_mini
from:"-09647.4657" to: "-096 47.4657" The space makes the difference to Google.
I wrote this routine to write a byte at a time to the SD card with no success. Is it failing because there are no terminating Nulls on each character? Not sure how to correct that... I have been reading up on the FORMAT sprintf() command, but again am not sure if this is going in the right direction.
As always any help or suggestions are appreciated!
Paul
DAT gpslog byte "007.kml", 0 ' Name of file that we will write to PUB ForKML ' WRITE DATA TO SD CARD sdfat.popen(@gpslog, "a") SDwrite(string("-")) index := 0 repeat 4 ' loop for the number of characters in the buffer location SDwrite(byte[noparse][[/noparse]value + index++ ]) SDwrite(string(" ")) '*** inserts the space between DD and MM.mmmm repeat 7 SDwrite(byte[noparse][[/noparse]value + index++ ]) SDwrite(string(" ")) sdfat.pclose
Comments
Sometimes the forum software messes the tabbing up, but I think that is your problem.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I am 1010, so be surprised!