Home > Uncategorized > Integrating Google Earth with a Java webapp

Integrating Google Earth with a Java webapp

November 11th, 2007 deevis

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:


application/vnd.google-earth.kml+xml
kml


application/vnd.google-earth.kmz
kmz


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.

Share and Enjoy:
  • Print this article!
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • LinkedIn
  • StumbleUpon
  • Technorati
  • TwitThis
Categories: Uncategorized Tags:
Comments are closed.