The center of gravity calculator previously featured on Ogle Earth, although it worked for me on my Mac, didn’t seem to work for many others. Via helpful comments, it began to look like it might be a Mac vs. PC thing.
I can now confirm that this was indeed the case. Saving a folder with placemarks to the desktop produces KML that differs according to the operating system you’re using. The unexpected part is that it’s the Mac beta which produces the most complete KML, whereas the PC version produces something quite sparse (though well-formed) that doesn’t preserve the state of the saved placemarks. Here is the PC file, and here is the Mac file.
One difference is that the PC saves a KML file with a <Folder> element at its root, whereas the Mac uses <Document>, into which it places a <Folder>. But more importantly for debugging the calculator, the Mac version also saves <visibility> and <open> for each placemark, so that later, the folder’s state is preserved when the KML is uploaded back into Google Earth.
The calculator assumed each placemark had such a visibility tag, and calculated the center of gravity only for placemarks flagged as visible. Since the PC version contains no visibility tags, the script found 0 visible placemarks, hence the division by zero error.
I have now removed the visibility test from the calculator. All placemarks are counted, visible or not. The calculator now works for me with PC-generated files that broke previously. Do let me know if you still have problems. Once again, the center of gravity calculator.
[Update 2006-02-11 12:48 UTC: And not a minute too soon — the latest Mac version of Google Earth (3.1.0617.0 beta) no longer saves down folders with visibility tags.]