Converting Google Eath's .KML to .OSM


I’m trying to convert GE’s KML file format into OSM, to then convert to an IMG to upload to my Garmin.

I tried to use GPSBabel, but it doesn’t appear to support GE’s Folders structure.

For example, in my case, I have a list of park names in a folder called Parks (There are other items in different folders). Loosing the folders when GPSBabel converts means that when I convert OSM to IMG, using mkgmap, the Garmin has no way tell that they’re Parks & therefore unable to render them.

I’m trying to create my own conversion routine by learning how to use XSLT which can be used to transform KML to OSM but I’m struggling.

Has anybody come across someone already doing this, who I can learn from?

Dave F.

You want to convert one file in another.

Then suddenly you are talking about a folder structure. You did not explain where the folder structure comes from or has to do with a .kml file. So I can not follow you.

Please elaborate.


GE = Google Earth.

GE has, when you open it up, has a side bar called ‘Places’ on it left hand side. Goto View>Sidebar to display it.
This Places displays imported GPx or in this case KML files. If you’ve just loaded in a KML file it will be displayed at the bottom of the list in Places in a section called Temporary places.

My KML file has data stored in format of Parent/Child folders similar in concept to folders as displayed in MS Windows Explorer.

GPSBabel takes this KML data file & attempts to convert it into OSM format, but deletes the title data of the folders ie, Parks.

As I said, without this info in the OSM file, mkgmap, which I’m using to convert OSM to IMG format doesn’t know how to render correctly (IMG is the format that Garmin understands)

Do you need me to expand on what XSLT is? If so, then you’re probably not going to be able to help me with my problem.

Dave F.

Why convert to IMG and not simply to a GPX file which you can send to the Garmin ?


@DaveF: You want to convert the data within a file to another file in another format. Please post a piece of a .kml file here and post also a piece of .osm data which is the conversion for the .kml data as you want it.

@Chris66: Which Garmin devices can handle .gpx files? (I wish my 60Cx could).

GPSBabel has an option to add tags to all ways or nodes when exporting to OSM format, use the “tag” option.
eg use something like

gpsbabel -i kml -f parks.kml -o osm,tag="lesiure:park" -F parks.osm

That will tag all of the ways as leisure=park, which will then get converted by mkgmap to IMG format.

For separate folders for different types of ways, I think the easiest option would be to use Google Earth to save each folder to a separate KML file.

Thanks for the replies

KML data can contain data other than ways & POI’s such as filled polygons (the area of the park) . AFAIK GPX data can not store this. It’s not a track that I want to convert, but info about what the track travels along & over such as roads & through these parks.

I send a ship soon. I’m still trying to work out was is required (which was a part of the reason for my original question)

I didn’t know this & could work as a half way house, but it still needs human interaction to split the KML .