Convert CSV to KML/KMZ using Google Maps
In my last post, I was bulk gathering GPS coordinates from the internet. After I had them, I still needed a method to display them. Luckily, Google My Maps offers a versatile import function. Every new layer can bulk import data from a variety of data formats.
On Wikipedia, coordinates are displayed in the degree-minute-second format. Since Google Maps seems to favorite the degree-decimal format, I was uncertain if importing would convert them to the correct location.
The import worked without any issues in with this format. You can import CSV, XLSX, KML or GPX with Google Maps. Google Maps will prompt you for the meaning of each of these fields after you import the CSV. It will even ask you for the format of the coordinates (latitude,longitude vs longitude,latitude).
In order to convert this location data into KML, all I needed to do was export it. The export function can be found in the options for the entire map. You can choose which layers to include in the dialog.
KML is an XML based format. Once you export the map, you can open it up in any text editor to see the data it produced.
<Placemark> <name>Alpha, California</name> <description>39°19′50″N,120°46′53″W</description> <styleUrl>#icon-seq2-0-0-0288D1-labelson</styleUrl> <Point> <coordinates> -120.781388888889,39.3305555555556,0 </coordinates> </Point> </Placemark>
If you want to try it out for yourself, you can use the same map I referenced in this article: Nevada County Ghost Towns