NMEA file to KML conversion

hello

I have a GPS project which normaly outputs NMEA text files on the SD card. I need it to output KML files in order to be able to be opened in Google Maps. Any hints on how to make the conversion?

google "nmea to kml"

popescu_eduard:
I have a GPS project which normaly outputs NMEA text files on the SD card. I need it to output KML files in order to be able to be opened in Google Maps. Any hints on how to make the conversion?

From what your descriptions says:

  • open NMEA file for reading
  • open KML file for writing
  • read in one line NMEA code
  • if the line contains geographical coordinates ==> write them into KML file
  • after processing all lines: close NMEA file, close KML file

But perhaps your file contains too many data and you want to reduce the number of waypoints in your KML file. In that case the Ramer–Douglas–Peucker algorithm may be helpful in reducing the number of waypoints.

jurs:
From what your descriptions says:

  • open NMEA file for reading
  • open KML file for writing
  • read in one line NMEA code
  • if the line contains geographical coordinates ==> write them into KML file
  • after processing all lines: close NMEA file, close KML file

But perhaps your file contains too many data and you want to reduce the number of waypoints in your KML file. In that case the Ramer–Douglas–Peucker algorithm may be helpful in reducing the number of waypoints.

Maybe I didn't explain enough or well enough. At the moment my project, my GPS logger shield connected to Arduino Mega, is able to log NMEA (.txt) files on the SD card on the shield containing NMEA sentences such as GPRMC. Instead of those NMEA files, I need it to log KML files so that Google Maps API could read it without problems.

I found out on www.toptechboy.com in this link that first I have to transform my gps latitude and longitude into decimal form in order to be ok for Google Maps, and then he puts a "wrapper" of xml code around the coordinates and saves it as kml file. I need arduino to do this operation for me directly during the logging.
Is it now clear enough?

The algorithm might be useful though, thanks a lot!

popescu_eduard:
first I have to transform my gps latitude and longitude into decimal form in order to be ok for Google Maps, and then he puts a "wrapper" of xml code around the coordinates and saves it as kml file. I need arduino to do this operation for me directly during the logging.
Is it now clear enough?

What's the problem?`

KML-Files are text files, so take a text editor of your choice, open a KML file which contains data in a format you want to generate, then just look at the lines, and you will see how longitude/latitude are embedded in that file.

For reference see: KML Documentation Introduction  |  Keyhole Markup Language  |  Google Developers

jurs:
What's the problem?`

KML-Files are text files, so take a text editor of your choice, open a KML file which contains data in a format you want to generate, then just look at the lines, and you will see how longitude/latitude are embedded in that file.

For reference see: KML Documentation Introduction  |  Keyhole Markup Language  |  Google Developers

I probably need to put some code in my .ino program/project and I don't understand which and where to put it. I asked the guy from toptechboy and he said that is pretty difficult to do what I need to do and that I need to know how to manipulate strings. This I don't know

Am i going to need a KML/XML to C++ converter or something like that?

popescu_eduard:
Am i going to need a KML/XML to C++ converter or something like that?

I don't understand the question.

NMEA is what you have.
KML is what you want.
Both file formats are "ASCII text" formatted.

And to do the conversion from one format into the other, you'd have to write C++ conversion code that does the job.

For developing C++ code you just need your brain containing some knowledge of C++ programming.

jurs:
I don't understand the question.

NMEA is what you have.
KML is what you want.
Both file formats are "ASCII text" formatted.

And to do the conversion from one format into the other, you'd have to write C++ conversion code that does the job.

For developing C++ code you just need your brain containing some knowledge of C++ programming.

ok.. please tell me where do I find this code, or tutorials, or examples, etc.

tutorial - http://www.arduino.cc/en/Tutorial/HomePage

robtillaart:
tutorial - http://www.arduino.cc/en/Tutorial/HomePage

maybe pointing me to something more specific?

There is no specific tutorial for your problem. You should go through the sketches and pick up the parts that relate to your problem. You will probably recognize them more easily than we can.

Rob Tillart, why didn't you tell me about this? - simple XMLwriter library for Arduino - Libraries - Arduino Forum
I thinks this will help me. You could've saved me tons of hours of research.

Didn't think of it, but you are right KML is an XML based language, so it is "relative" easy to make a KML file.

See - simple XMLwriter library for Arduino - #17 by robtillaart - Libraries - Arduino Forum -

ok, it seems I got it all wrong. I just needed to do what the guy on www.toptechboy.com did, so I solved the problem whit the KML conversion.

Before I finish my project, there is only one thing left that I have to do. Alongside the route that I will show in Google Earth, I need to also show temperature via the TMP102 sensor that I have. For that I have to do some modifications in the xml code. I searched on the web for this and I couldn't be able to find anything. Not even in the kml documentation from google.

any tips?