KML4Earth


Reference

© Copyright 2011 jasonm1

logo Google Earth Property Debug Tool

KML supports a feature called a NetworkLink that can chain static KML files together or dynamically generated KML via a "servlet" at the end of a URL.

An example KML file with Networklink shows all the available properties from the Google Earth client as described below.

To see it for yourself, you can download this KML file

Google Earth Screenshot
Screenshot of DebugTool generated balloon description

A related KML file uses the BBOX property from which to generate a placemark at the center of the view. Useful tool if you need the exact center latitude/longitude of the current view in Google Earth.

The power of the NetworkLink in KML is the ability to receive the client properties from Google Earth which include characteristics of the map view and the Google Earth client itself. Using these properties a backend service could tailor the information to the current view and/or settings of the map. This can greatly reduce data that won't be useful in the target context. Having 3-D terrain enabled could generate a different set of content then if it's disabled as is knowledge of the map screen resolution. No personal information other than these properties can be passed from Google Earth to a backend service through this mechanism.

View properties:

  • BBOX=[bboxWest],[bboxSouth],[bboxEast],[bboxNorth] - This information matches the Web Map Service (WMS) bounding box specification. This defines the north, east, west, and south-most coordinates of the current view but note that the bounding box is larger than what is actually displayed.
  • [lookatLon], [lookatLat] - longitude and latitude of the point that <LookAt> is viewing
  • [lookatRange], [lookatTilt], [lookatHeading] - values used by the <LookAt> element (see descriptions of <range>, <tilt>, and <heading> in <LookAt>)
  • [lookatTerrainLon], [lookatTerrainLat], [lookatTerrainAlt] - point on the terrain in degrees/meters that <LookAt> is viewing
  • [cameraLon], [cameraLat], [cameraAlt] - degrees/meters of the eyepoint for the camera
  • [horizFov], [vertFov] - horizontal, vertical field of view for the camera
  • [horizPixels], [vertPixels] - size in pixels of the 3D viewer
  • [terrainEnabled] - indicates whether the 3D viewer is showing terrain
Also available are basic client properties:
  • [clientVersion] - version of the Google Earth client (e.g. 6.2.2.6613)
  • [kmlVersion] - KML version supported (usually 2.2)
  • [clientName] - name of client (normally Google Earth)
  • [language] - default language of client (e.g. 'en' for English)

Details

Under the covers, Google Earth rewrites the URL it connects to and appends the values of the httpQuery and viewFormat parameters after performing an entity substition. So for example, if the NetworkLink element is defined as such:
<NetworkLink>
  <Link>
    <href>http://server/myServlet</href>
    <httpQuery>clientVersion=[clientVersion]</httpQuery>
    <viewFormat>terrainEnabled=[terrainEnabled]</viewFormat>
  </Link>
</NetworkLink>
Then the URL called by Google Earth would be something like the following through an HTTP GET request:
http://server/myServlet?clientVersion=6.2.2.6613&terrainEnabled=1


Related Resources

Google Earth (TM) and Google Maps (TM) are registered trademarks of Google Inc. KML4Earth is not affiliated with Google.

Created and maintained by jasonm1