My Google Earth "My Places" will no longer populate when I open Google Earth. I still have access to the KML file. Is there a way to repair or trouble shoot the KML file to salvage the data? The KML file is approximately 350MB.
1 Answer
First option is to restore a backup copy of saved places file before it was corrupted (if one is available). Details for the location of saved places file (myplaces.kml) can be found in https://support.google.com/earth/answer/166438. If you're very lucky then a file named "myplaces.backup.kml" will be found in the same location as myplaces.kml and will be a good version. When Google Earth is not running try these four steps:
- Rename myplaces.kml to myplaces-broken.kml
- Copy myplaces.backup.kml to a new file; e.g. myplaces.backup.orig
- Rename myplaces.backup.kml to myplaces.kml
- Restart Google Earth to verify if the backup works
If you need to repair the saved places file then continue reading. The saved places file like any KML file is XML so any techniques to fix an XML file apply.
Some problems are easy to identify and fix but others may take some time especially if the file is large. You may have to do it by trial and error. Save a new temp file at each step so you can revert back to the previous version.
1) Verify KML file is a well-formed XML file
The first step is to validate the KML file is still a well-formed XML file.
For example a valid myplaces.kml file should have this basic structure:
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2"
xmlns:kml="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom">
<Document>
<name>default_my_places</name>
<open>1</open>
<StyleMap>
...
</Document>
</kml>
Start by copying the myplaces.kml file to a new file with a ".xml" extension (e.g. places1.xml) then drag that file onto a web browser. Nearly all modern web browsers (e.g. IE, Chrome, FireFox, etc.) will show the line number and column number of XML errors when are encountered such as a mismatched tag.
If, for example, duplicate namespace declarations are found then they must be removed. Loading it in IE would show an error such as this:
Duplicate attribute. Error processing resource 'file:///C:/temp/myplaces.kml.xml'.
Line 2, Position 127
Fix any errors and repeat until there are no more errors.
2) Fix KML in parts until some or all display in Google Earth
Now that the myplaces file is well-formed XML file, rename it back to a KML file (e.g. places1.kml) and try to open it with Google Earth.
NOTE: At each stage, save a new temp file; e.g. places2.kml, places3.kml, etc. Do this if/when need to revert back to a previous version.
Fortunately, the myplaces.kml file is indented so finding start and end tags can usually be done by finding next matching tag at the same indentation level.
...
<Folder>
<name>My Places</name>
<open>1</open>
<Folder>
<name>my folder</name>
...
</Folder>
<Folder>
<Placemark>
<name>Untitled Path</name>
<visibility>0</visibility>
<styleUrl>#msn_ylw-pushpin</styleUrl>
<LineString>
<tessellate>1</tessellate>
<coordinates>...</coordinates>
</LineString>
</Placemark>
...
</Folder>
</Folder>
</Document>
</kml>
Start by adding XML comments to enclose large sections of the myplaces.kml file and make it enclose larger sections until the KML file loads without errors and displays then move the comment block to smaller sections until the damaged section is isolated.
<!--
<Folder>
...
</Folder>
-->
3) Revert saved places file when done
When the KML file displays all your placemarks correctly and all the XML comments have been removed then it's ready to put back in the original location. Make sure Google Earth is not running. Next copy that file and overwrite the myplaces.kml file. Now restart Google Earth and the saved places should be restored.
Note the techniques above describe restoring the Google Earth saved places file (myplaces.kml) but the trick of adding XML comments to the KML file apply to repairing any large KML file.
</Document></kml>
tags? You can find your saved places KML file here.