Today I had to take over some places a collegue marked in Google Earth. Maybe I was too blind or actually too stupid but I was not able find a simple tool for converting KML to an ArcGIS-compatible format. Except FME of course, but that would be the overkill for my purposes. So I wrote a quick and dirty XSLT-hack to convert a KML-file to a very basic CSV-structure, which I could later import as X/Y coordinates to ArcGIS.
I had following structure in Google Earth:
Saving the folder as kml brought me this file (GE_original.kml).
For some reasons (I’m no XSLT expert) I had to delete the KML namespace declaration and of course add the XSL-stylesheet information. See the modified KML file here (GE_modified.kml).
The XSL-file I wrote you can find here (kml2csv.xsl).
Put your modfied KML file in the same folder as kml2csv.xsl and open it in a XSLT compatible Browser. You should see now coordinates and placemark names in a CSV structure instead of a KML-XML-tree:
Save it as text file, open it in ArcGIS (or in your prefered GIS client, spatially enabled DBMS, spreadsheet app or wherever you want) and add the X/Y coordinates to your layer. For now the XSLT is limited to placemarks and it only works if your placemarks are contained by exactly one folder – as I said, a quick and dirty hack.
Further improvements to come (as soon as I have some time left):
- the conversion of KML to GML would be a more elegant way
- support of lines and polygons
Google Earth is a nifty tool to create some spatial notes and simple geographic objects. It’s easy to use, offers access to basic geodata but it’s definitely not a tool to produce large and complex geodatasets.