Google Earth -> .gpi POI process on the Mac


Much thanks to Simon Slavin for putting the effort into making a POI loader for the Mac (MakeGPI). I noticed the Windows instructions of creating POIs from Google Earth, but haven't found anything for creating them on the Mac (please point me to a solution if you know of one!). With a little free time on my hands, I was able to kludge together a rather ugly process to create a POI file from a Google Earth location. I only did it for one location and there was a lot of file mangling by hand so I want to work on it some more when I get the time (HA!). But for those that are curious:

You will need the following items:

  • Google Earth (download here)
  • Firefox (download here)
  • A text editor (like TextWrangler)
  • MakeGPI (download here)
  • kml2csv.xsl (download here)

The process:

  1. Add the location(s) that interest you into Google Earth.
  2. Using a text editor, open the "myplaces.kml" file (located in ~/Library/Application Support/Google Earth/).
  3. Save a copy of the myplaces.kml file (let's call it "foo.kml" for clarity) into a new folder along with the "kml2csv.xsl" file.
  4. This is where it gets ugly - editing the "foo.kml" file. You basically want the location data you're interested in to come in the following manner (note you'll need to change the KML namespace declaration to the stylesheet info):

    <?xml version="1.0" encoding="UTF-8"?>
    <?xml-stylesheet type="text/xsl" href="kml2csv.xsl" ?>

    <name>Name of your POI</name>
    <description>Any comment you would like to include.</description>

    (any additional locations should follow the format between the "<Folder>" and "</Folder>" tags)

  5. Before you save that wonderful piece of KML, you need to do one more thing: delete the trailing ",0" in the "coordinates" field. I presume it's for elevation and as far as I can tell, MakeGPI will choke on that bit of information. Once you do that, go ahead and save "foo.kml".
  6. Open "foo.kml" in FireFox. Your data should simply read:

    Name of your POI,00.00000000000000,10.00000000000000

    If you read through the details on the "kml2csv.xsl" page (thanks to Christian Spanring for that piece of code too, by the way), you know that his stuff is doing its job.
  7. Choose "Save Page As..." within Firefox and save it as a text file with the name "bar.csv".
  8. Now if you consult the MakeGPI page, you'll notice that this data is not arranged exactly as MakeGPI expects it. Open "bar.csv" in your TextWrangler and you'll notice that there's additional problems - namely, Firefox doesn't save it as a comma-delimited file (what CSV files are). So you will need to massage the data into the following format:

    00.00000000000000,10.00000000000000,Name of your POI,Any comment you would like to include.

    Oh yeah - that's not a typo that Firefox didn't show the description field either. If you want comments, either massage the "kml2csv.xsl" file to do that (you could even get it to put the data in the proper order for MakeGPI too) or hand-enter it in.
  9. Once you make the changes, get it in the proper format and save "bar.csv", drop the file on MakeGPI, answer the questions it poses and out comes your "bar.gpi" file!
  10. Synchronize the "bar.gpi" file with your GPS of choice and you're ready to go!

Like I said earlier, this is a crazy-ugly kludge to go from Google Earth to a .gpi file that your GPS will read. If you're only doing one or two locations, this is definitely a lot more effort than it's worth (but then again, is hand-editing that KML file worth the effort for more locations?) - you can just as easily open TextWrangler, put the 4 bits of information per line and drop the file on MakeGPI.

There's a lot of room for automation to cut the extraneous stuff out, which I would love to do - but I'm not sure when I'll get the opportunity to do that. If someone else out there has the time and the knowledge to do it, please by all means! TextWrangler's beefy Search & Replace feature and some handy HTML/XML authoring will skip you a lot of steps until a nicer solution is available. And, of course, if anybody else knows of an easier method please let me know!


what about using gpsbabel?

what about using gpsbabel? Looks like it can convert directly:

{by rote; not tested}
gpsbabel -i kml -f test.kml -o garmin_poi -F test.csv

I don't have any .kml to experiment on but gpsbabel does this kind of thing painlessly.

Might have to compile it on the mac; dunno.

US-only CoPilot + android Optimus T = cheap, effective nav

US-only CoPilot + android Optimus T = cheap, effective nav


It works:

mouse@hangedman:~/temp/kl$ gpsbabel -i kml -f tutorial.kml -o garmin_poi -F tutorial.csv

mouse@hangedman:~/temp/kl$ ls -l
total 44
-rw-r--r-- 1 mouse mouse 1427 2006-12-29 13:41 tutorial.csv
-rw-r--r-- 1 mouse mouse 39957 2006-06-15 15:50 tutorial.kml

mouse@hangedman:~/temp/kl$ cat tutorial.csv
-122.08220,37.42229,Simple placemark,Attached to ground. Intelligently places itself at
-122.08407,37.42200,Floating placemark,Floats a defined distance above the ground.
-122.08577,37.42157,Tethethed placemark,Tethered to the ground by a customizable "tail"
-122.08565,37.42243,Example Placemark,Example Placemark
-122.08565,37.42243,Example Placemark,Example Placemark

mouse@hangedman:~/temp/kl$ gpsbabel
GPSBabel Version 1.3.2.

gpsbabel [options] -i INTYPE -f INFILE -o OUTTYPE -F OUTFILE
gpsbabel [options] -i INTYPE -o OUTTYPE INFILE [OUTFILE]

US-only CoPilot + android Optimus T = cheap, effective nav

Most excellent! Thanks for

Most excellent! Thanks for the pointers Fratermus! Haven't tried it yet, but it definitely looks a lot easier!