Convert CSV to KML/KMZ using Google Maps

Convert CSV to KML/KMZ using Google Maps
Photo by David Lang / Unsplash

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.

Name,Location for Google
"Alpha, California","39°19′50″N,120°46′53″W"
"Badger Hill, California","39°12′58″N,121°02′58″W"
"Baltimore Town, California","39°23′12″N,120°31′51″W"
Google Maps Import CSV Sample

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