Ever find yourself with 100 KMZ files when you wanted KML files?

So the other day someone sent me about 100 KMZ files that he had made by pinning points in Google Earth. He then said “Can you do….with these files?” The exact details don’t really matter, point is KML files are super easy to parse and work with compared to their zipped KMZ counterparts. Anyway, I didn’t feel like clicking on them all to unzip them and then rename them (Google Earth names the internal KML file doc.kml if you didn’t know that already). Since I had 7-zip installed I figured I’d write a quick script to unzip them and rename the doc.kml file based on the name of the KMZ file it came from. Ruby to the rescue; in just a matter of minutes I had my solution and it worked out really well. Anyway, if you ever find yourself in this boat here is the code I used: http://www.geooutlook.com/code/ruby/unzip_kmz_rb.html

Tags: , ,

Comments are closed.