In January we created a simple KML converter that takes a KML file and produces a csv file that is easily opened with Microsoft Excel. Recently GEB reader David Kettle asked whether it would be possible to go both ways.
So, we have used an open source tool called SheetJS for reading and writing Excel files in JavaScript and have made a two way process.
To use it, simply upload a KML or KMZ file below and it will extract all the placemarks, paths or polygons into an Excel file. You can then edit the data in the Excel file then upload that and it will convert it back to a KML file.
Notes:
- All styles, folders, etc., are lost in the conversion.
- It only extracts the outer edge of a polygon. If there are ‘cutouts’ then they will be ignored.
- It doesn’t currently extract folder names. We will consider adding that as a feature in the future.
- It extracts the longitude/latitude/altitude data in the format used in KML rather than separating them into columns. This was to make it easier to handle both points and polygons.
- When we tried it on very large polygons, Excel gave an error – most likely caused by a limit on the amount of text allowed in a single cell.
The intent was not to create a universal converter but to provide a very simply utility, and to give those with some programming knowledge a starting point if they wish to create something more complex. Feel free to use any of the code used in the page. The original KML API can be found here The version used in the page was run through Babel to make it compatible with older browsers.
About Timothy Whitehead
Timothy has been using Google Earth since 2004 when it was still called Keyhole before it was renamed Google Earth in 2005 and has been a huge fan ever since. He is a programmer working for Red Wing Aerobatx and lives in Cape Town, South Africa.
Timothy… I took a small .kml file I had made of a trail to test converter. Converter made a .csv file which when opened in Exel gave warning that it needed to be “repaired” (but all I could find is possibly the heading info). I changed a couple words and wrote it back out to a .csv file but it warned me that .csv might not contain data that a standard exel format would. I chose .csv anyway.
Then I used the resulting .csv file to create a kml file and did get a file but which contained a bunch of blank waypoints. no styling no correct icons for placemarks, no descriptions and no coordinates.
i don’t see any place to attach the files or i would give you the examples.
This converter doesn’t use CSV files, it uses Excel files (extention .xlsx) I believe the warning about needing to be ‘repaired’ is very long polygons that have too many coordinates to fit in one Excel cell. All style information is lost in the two way conversion.
Ahh… I’ve just gone in and out of excel with comma delineated files for so long I made an assumption.
And, you may be right about the length although all my waypoints were linear trails – which is probably why visualizer and other things I’ve used use the comma delineated fields file type.
There are a number of websites that do conversions, my favorite is:
http://www.gpsvisualizer.com