You've seen the beautiful images of Earth from space taken by NASA
astronauts and satellites. By viewing a series of images one after
another like frames of a movie, we can watch changes to the Earth as
they happened. You can follow hurricanes moving towards land and
observe ice caps contracting. You can replay and study changes due to
weather, natural events, and human activities. NASA has assembled
dozens of such animations, all free. This article describes how
to write Java software that uses the
OpenGL graphics interface to display these images on a 3D globe.
The Scientific Visualization Studio
A team of expert scientists, engineers, and artists at NASA's Scientific
Visualization Studio (SVS) carefully compose these animations. This group
performs their magic at NASA's Goddard Space Flight Center in Maryland.
They have been creating animated visualizations of Earth and space science
data for over 15 years. They select images from a seemingly infinite
collection of NASA imagery. They design each animation to illustrate a
particular phenomenon or event. Here are two examples:
Figure 1.
African fires during 2002
Figure 2.
Atmospheric water vapor during 1998
Recently, SVS established an image server to make some of the best earth
science animations available programmatically over the internet to software
applications. Currently about 80 are available; that will grow to over 130 by
October, 2005. You can see the growing list at the
SVS server site.
The full SVS catalog contains over 2500 animations and is at
the SVS home page.
SVS animations dynamically illustrate the formation of what's shown
in these static images: The fires in Africa progress southwards with
the season. The vapor and rain (yellow) flow across the globe as the
days progress. You can see more single shots like those shown
above at the SVS website, but they're really meant to be seen
"in motion," wrapped around a 3D Earth. The SVS website doesn't do
that. You need a software program running on a local computer to get
the full effect. You also need the ability to interact with the model
by turning the world around and zooming in and out. In this article, I
describe a bare-bones program, in order to keep the
code easily understandable. The best program for viewing SVS
animations is the free and open source
program NASA World
Wind.
SVS Animations in Your Software
SVS imagery is designed to be used in educational software. The web service
responds to HTTP requests by returning an image. There's a strict
protocol and request language, with the request parameters tacked on
to what we'd consider a conventional URL.
Four steps are required to retrieve and display SVS
animations in 3D:
Query the SVS server to determine the animations that are
available from the server's table of contents.
Form and send requests and retrieve the images of the
animation. Each image requires a separate request.
Convert the images to texture maps so they can be wrapped around
a globe using OpenGL.
Display the images in sequence to "play" the animation.
EarthFlicks, the Example Application
The code I'll use to demonstrate and explain all this is a small
Java application called EarthFlicks, which is available for download at
the end of this article. EarthFlicks creates two windows: one for
selecting and retrieving animations from SVS, the other for showing
and playing them. Figure 3 shows what it looks like:
Figure 3.
EarthFlicks
Selecting an animation in the table and clicking the Import button
causes EarthFlicks to retrieve and cache locally all the images for
that animation. When they are subsequently played, EarthFlicks
recognizes them in the cache and draws the images from there, rather
than from the SVS server.
EarthFlicks has been kept as simple as possible in order to keep
its code clear and useful in a tutorial. However, retrieving and
playing SVS animations requires a lot of code; more than I would have
guessed before I started writing EarthFlicks. Not all of that code can be
listed in this article. What are listed are important details unique to
the task. The rest is documented in the source files themselves, which
are available at the location mentioned above.