Integrating Google Earth with a Java webapp
I did this at work the other day and thought I’d give the broad sweeping overview here should else want to do it. It’s not too bad after all’s said and done ( and sifted through… ). Here’s the quick and easy:
1) Add these mimetypes in web.xml:
2) You’ll want to write back KML ( a flavor of XML ) with a content-type of “application/vnd.google-earth.kml+xml”:
response.setContentType(”application/vnd.google-earth.kml+xml”);
3) Make sure you give the stream a default filename that ends in .kml or else GoogleEarth won’t actually process the file.
response.setHeader(”Content-Disposition”, “attachment; filename=” + filename + “.kml”);
That’s really a 40,000 foot view of the process. Here’s Google’s KML Tutorial so you can learn more.















