There have been [suggestions](http://www.spiegel.de/international/spiegel/1,1518,429525,00.html) recently that Google Earth is a "powerful tool" for science. [Some](http://ccablog.blogspot.com/2006/08/gis-shortcomings.html) disagree. At least [one amateur](http://www.astroseti.org/impacts.php) used Google Earth to find an asteroid impact crater.

I just wanted to give context to imagery viewed in ENVI (similar to my [Google Maps user function](http://michaelgalloy.com/2006/04/17/update-to-google-maps-lookup-for-envi.html)). `MG_WRITE_KML` produces a KML file and an image suitable for viewing in Google Earth. The KML file includes lat/lon information to locate the image. The user function is only one file: [`MG_WRITE_KML`](http://michaelgalloy.com/lib/envi/mg_write_kml.pro) (docs).

Let me know if you use Google Earth for science and if this user function is useful for you.

Usage of `MG_WRITE_KML` is bit more complicated than `MG_GOOGLE_LOOKUP`, but still straightforward:

1. Download [`MG_WRITE_KML`](https://github.com/mgalloy/mglib/tree/master/src/envi/mg_write_kml.pro) and put it in ENVI's `save_add` directory.
2. Open an image with map info in ENVI.
3. Display the image.
4. In the menu for the display window, select Tools > Write KML file for Google Earth.
5. After you select an output filename, `MG_WRITE_KML` will write the KML and TIFF files.
6. Open the KML file in Google Earth.