Google Earth API

Sky, Mars, and Moon

  1. Viewing Sky
  2. Viewing Mars
  3. Viewing the moon

Viewing Sky

The Google Earth Plugin is able to display objects in the sky, such as stars, constellations, planets, the Earth's moon, and galaxies. When the application switches to Sky mode, the viewport transitions to show the sky at a point above the camera's current position, as measured from the center of the Earth (the zenith). The celestial data is mapped onto the inside of a virtual sphere that surrounds the Earth.

Setting the map type

Use the following set method to display Sky mode:

ge.getOptions().setMapType(ge.MAP_TYPE_SKY);

Use the following set method to display Earth mode:

ge.getOptions().setMapType(ge.MAP_TYPE_EARTH);

Source: http://earth-api-samples.googlecode.com/svn/trunk/examples/sky.html

ge.getOptions().setMapType(ge.MAP_TYPE_SKY);

var lookAt = ge.createLookAt('');
lookAt.set(41.28509187215, -169.2448684551622, 0, ge.ALTITUDE_RELATIVE_TO_GROUND, 262.87, 0, 162401);
ge.getView().setAbstractView(lookAt);

Coordinates

Celestial coordinates are described in terms of right ascension (RA) and declination. Right ascension, which corresponds to longitude, represents a distance from the point in the sky where the sun crosses the celestial equator at the vernal equinox. Right ascension is measured from 0 to 24 hours, with one hour of RA equal to the amount the sky rotates above a given point on the Earth's surface in one hour of time. Zero hours of RA is at the point of the vernal equinox, with RA increasing eastward from that point.

Convert Declination Coordinates

Declination coordinates correspond directly to latitude values, ranging from −90° south of the celestial equator to +90° north of the celestial equator.

Calculating Range for the LookAt Object

When you use the LookAt object with sky data, you need to perform the following calculations to determine the range. The basic formula is as follows:

r = R*(k*sin(β/2) - cos(β/2) + 1)

where:

  • r is the range, specified in the <LookAt> element.
  • R is the radius of the celestial sphere (or, in this case, the Earth, since we're effectively inside it looking out at the sky), which is equal to 6.378 x 106.
  • k is equal to 1/tan(α/2), or 1.1917536.
  • α is the angular extent of the view in Google Earth when the camera is pulled back to the center of the celestial sphere (Earth).
  • β is the desired arc seconds of your sky image.

Note: The Google Calculator is a handy tool for making such calculations.

Here are some sample ranges:

  • Large spiral galaxy (Sunflower Galaxy): 20-30 km
  • Large globular cluster (M15): 20-30 km
  • Andromeda Galaxy: 200 km
  • Planetary Nebula (Owl Nebula): 5-10 km
  • Large Nebula (Trifid Nebula): 10-30 km
  • Single Hubble Pointing (Seyfert's Sextet): 2-5 km
  • Open star cluster (Praesepe): 30-60 km
  • Smaller spiral galaxy: 5-10 km
  • Large Magellanic Cloud: 400-500 km

Viewing Mars

The Google Earth Plugin isn't just the Earth and the sky - you can also view detailed imagery of Mars, including 3D terrain. To do so, specify the Mars imagery database when calling the google.earth.createInstance() function:

google.earth.createInstance('map3d', initCB, failureCB, { database: 'http://khmdb.google.com/?db=mars' });

Unlike Earth and Sky modes, which use MAP_TYPE_x arguments, Mars can only be loaded upon plugin initialization. To switch from Earth to Mars, you'll need to clear the existing Earth instance before loading a fresh Mars instance:

function showMars() {
  document.getElementById('map3d').innerHTML = '';
  google.earth.createInstance('map3d', initCB, failureCB, { database: 'http://khmdb.google.com/?db=mars' });
}

LookAt and Camera views on Mars work the same way as on Earth. Some interesting locations to get you started are below (view them in the plugin).

  • Olympus Mons, the highest known volcano in the solar system
    lookAt.set(18.4, -134, 0, ge.ALTITUDE_RELATIVE_TO_GROUND, 0, 0, 650000);
  • The face on Mars
    lookAt.set(40.717, -9.424, 0, ge.ALTITUDE_RELATIVE_TO_GROUND, -44.158, 0, 10150);
  • Candor Chasma, a large canyon in the Valles Marineris canyon system
    lookAt.set(-6.276, -69.939, 0, ge.ALTITUDE_RELATIVE_TO_GROUND, 3.095, 35, 52800);

Viewing the moon

As with Mars, the moon view requires that its imagery database be specified upon plugin initialization. To do so:

google.earth.createInstance('map3d', initCB, failureCB, { database: 'http://khmdb.google.com/?db=moon' });

LookAt and Camera views on the moon work the same way as on Earth. Some interesting locations to get you started are below (view them in the plugin).

  • The Apollo 11 landing site
    lookAt.set(0.681400, 23.460550, 0, ge.ALTITUDE_RELATIVE_TO_GROUND, -1.946649, 0, 130);
  • The Aitken basin, the largest crater in the solar system
    lookAt.set(-16.800000, 173.400000, 0, ge.ALTITUDE_RELATIVE_TO_GROUND, -4.378803, 0, 135000);
  • The Lambert lunar crater
    lookAt.set(25.238916, -21.138078, 0, ge.ALTITUDE_RELATIVE_TO_GROUND, -1.811669, 0, 78000);

Authentication required

You need to be signed in with Google+ to do that.

Signing you in...

Google Developers needs your permission to do that.