Spherekit: A Tutorial


In this tutorial you will be using a software package called SphereKit developed by Cort Willmott, Robert Raskin, Chris Funk and Scott Webber for the NCGIA. This package is unique in that it uses actual distances on the sphere (great circle distances) derived via spherical geometry. The difference between actual great circle distances and distances on a 2-D cartographic projection can become quite siginificant at continental and global scales. In this lab you will use a canned dataset for the country of China. The data has precipitation, elevation, and temperature values for a large number of points scattered about the country of China. SphereKit produces a complete estimated field of all of these values via any number of different interpolation techniques. It also produces a field of error estimates at all points in the field. The error estimation procuedures it uses is a method called "cross-validation". We will examine this process as well as the following interpolation methods: Inverse Distance Weighting, Kriging, Splines, and Multiquadric interpolation.

Getting The Test Data

Follow these steps:

Running Spherekit

Spherekit allows you to manipulate eight different kinds of objects. Click on the little graphic icons that line up on the left of the Spherekit window. Read each of the messages for each of the eight objects. This should familiarize you with the Spherekit data types.

Creating a SK Project Directory

Spherekit allows you to organize your work into projects, each project corresponds to a sub-directory off of your Spherekit work directory.

Create a new work directory by selecting

When prompted for a name, enter 'tutorial' and hit return. tutorial will now become the current project, and all data objects will be stored in this location. Later, if you would like to return to this workspace, choose

Now we will create a Location Object in spherekit. Spherekit store locations independently of sets of values. This allows multiple sets of values to refer to the same set of locations. To import a set of locations choose:

When the dialog box appears, do the following steps to import the data.

  1. Enter China.net in the first field.
  2. Click on the 2nd field, and use the file dialog to find the 'china.dat' file
  3. Click Okay

This should generate a Network object called China.net. This object should appear in the Network section. Click on the object's name 'China.net', and examine its metavalues. Every new object should be examined in this manner.

Now we're ready to read some data values. Go to

Set the name field to 'Temperature'. Click on the ?????? in the locations field. ?????? is Spherekit's generic symbol for 'need this value'. Select china.net from the drop down menu. If the 'china.dat' file is not specified, select that file. Then click OK.

This should generate an Observations object called termperature. Click on Temperature and examine the metavalues.

Two "Spherekit Objects" should now be in the interface window now. One is named "Temperature" which is a temperature dataset for 160 weather stations in China. The second is called "China.net" which is the latitude and longitude of the nodes of the weather station network.

Generating a Plot of Temperature

Now we will create a dot map of the temperature field.

  • Display->Field

This opens a dialog box that looks like this -->

Under the Display Field heading click on the ?????? and select Temperature. Under the Projection heading Pick an appropriate projection for China. You may have to experiment with this parameter until you get a projection you think is good. Click OK when you have selected the display field and the projection. You should get a map of the Temperature data points for China that will look different based on the projection you choose, in any case the image below gives you a clue as to what it might look like:

This is the data from which you will be generating interpolated fields of Temperature. Before we can perform these interpolations we must create an interpolation method and a grid. What you are doing when you are creating an interpolation method is setting a bunch of parameters for the standard interpolation methods that Spherekit supports. For example, Inverse distance is one of the interpolation methods supported by Spherekit. When an inverse distance interpolater is run some things need to be decided. For example, if we are interpolating Temperature in the continental United States how many points do we want to use to interpolate a Temperature value in Tucumcari New Mexico? Should we use data from Seattle? How far away should we keep using points for. This problem is called the "Neighbor Selection problem" You need to provide parameters like how many neighbor points should be used?, within what radius?, etc. Another parameter to be set is the exponent of the inverse distance weighting. Gravity turned out to have a value of exactly 2.0. That is the default, but some processes optimize at values other than 2.0 and you can set that parameter also.

Creating an Interpolation Method

To create your interpolation method, do the following:

  • Interpolation->Create Method->Inverse Distance Weighting

This should produce a dialog box that looks like -->

Range Modes Sets the method of selecting neighbors.

The default settings for this method will select between 4 and 10 points and usually 7.

The Function Definition specifies a specific type of inverse distance weighting created by a gentleman named Shepard. These defaults are fine. Click OK to accept them. This creates a new method called Shep1 that should appear in the Spherekit window.

Creating a Grid to Interpolate to

In Spherekit a grid is simply a set of locations arranged at a regular distance (in degrees) form one another. To create a grid select:

Interpolate->Create Grid

You should see a dialog box like the one below:

You could play with these parameters, i.e. the resolution of the grid, the extent of area that you want to interpolate to, etc. For this example just accept the defaults by clicking OK. This will create an object called Grd1 that will show up in the Spherekit window.

Performing an Interpolation

Hooweee. Now we are ready to perform an interpolation. This will estimate a value at each of the cells in the grid you have just defined. To do this choose the following:

  • Interpolation->Begin Interpoaltion

This produces, you guessed it: yet another dialog box that looks like the one to the right.

Fill in this dialog thusly:

  1. Choose a name that makes sense for the output field name. E.G. TempInvDist
  2. Click on all the fields with ?????? in them and choose the appropriate objects.
  3. Then click "OK". This will produce a new object with the output field name you supplied.

After interpolation occurs, the display dialog box will appear. Select a Display Field that is the interpolated field object that you just created (It should be the default), Select a Graph Type that appeals to you (fool around here, grid plots and Isolines are different). Grid plots simply provide the value of the grid cell, while a contour plot smooths the image based on a Delaunay triangulation procedure.

Now choose the Options that appeal to you (we suggest super impose data values, and base scale on source). Then click OK. An image will appear. This can be printed if you like, by selecting print from the ghostview file menu.

Generating Images of the Estimated Errors for each of the Interpolation Methods

Spherekit contains a rather limited set of online help topics. Begin this section by selecting

This will bring up a list of the available help topics. Select Cross-Validation-At-Net and read the help message. Repeat this for Cross-Validation-At-Grid.

To make an image of the estimated error field select the following:

Complete these steps to fill in the field:

  1. Enter a meaningful (but conscise!) name for this error field.
  2. In the interpolation menu heading select one of your interpolation methods.
  3. In the interpolate from menu select Temperature.
  4. In the error interpolation method select Shep1.
  5. In the interpolate errors to field select the same grid you created earlier (probably Grd1).
  6. Click OK.

When the display dialog window shows up just click OK. This should bring up a ghostview representation of the estimated error.


NCGIA 1997