# Displaying Data in a Gradient Map

In the Display Demographic Data in a Thematic Map topic we saw how Manifold can display data by coloring the objects in drawings. At times we have data that is point data which we would like to display in the form of a gradient map, like that illustrated below, that shows smooth changes from one color to another that reflect the values of data in the map.

Gradient maps are usually created from data points. The task of the GIS software is to smoothly interpolate data between the points and to then color it as we desire. In Manifold, we use surfaces to easily accomplish these tasks.

This example shows how to take a collection of data points and create a gradient map. There are two main parts to this procedure: The first part is creating a surface from a collection of points and then coloring it. This is very fast and easy. The second part is trimming the surface so that it neatly aligns with other drawings or maps we might create. This takes a few more steps.

We begin with a drawing of data points. Each point has one field, that gives the percentage of students who drop out of school before completing high school.

We created this drawing by opening the Counties98_demog.map in the Data\US folder of the Manifold CD. We deleted all counties in the US except those in the continental, lower 48 states. We then created centroids for those counties and used those points as a drawing of data points.

The points are positioned at approximately the center of each US county. The drawing showing the points has been projected into Lambert Conformal Conic projection to show a more natural view of the US.

If we show the drawing of points together in a map with a drawing of the United States we can see how the data points are distributed throughout the country. (Some data points in Southern California are offshore, apparently the result of data points collected for offshore islands such as Catalina Island.)

Step 1: Create a Surface

Creating a surface is easy. Right click on the data points drawing in the project pane and choose Copy from the context menu. Next, right click on an empty part of the project pane and choose Paste As - Surface.

The Paste As Surface dialog pops up. By default, it offers a pixel size in meters, which we will adjust to a pixel size of 5 x 5 kilometers, for a total image size of 912 x 580 pixels (shown in the lower left corner) and about 2 megabytes. There is no extremely precise reason why we chose this pixel size and resulting surface sizeā¦it just seems like a good number considering the density of the points and the size of the United States. We check the Use radius option with a radius of 100 km to constrain the interpolation to a reasonable distance from the available data points.

The result is a surface. We will rename this surface Data Surface. When we open the surface we see the display above, which is something of a disappointment before it is colored with a palette. Note that some regions in the Southwestern part of the US are not filled in by the interpolation. The default interpolation radius and other parameters we chose do not allow the interpolation to entirely fill in this region because points there are too sparse. That's OK: Sometimes it is more important to leave an interpolation unfilled to warn the viewer that data for that region is lacking than it is to form a display that is beautifully filled in but fundamentally deceptive.

Note also that the surface has been created using the same projection as the drawing of points from which it originated. It is precisely georegistered.

Step 2: Color the Surface

The grayscale display is so ugly that before we do anything else we will color it using more appealing and informative colors. To color the surface with a palette we choose the View - Display Options dialog.

The dialog opens with default settings not using any palette to color the surface. For now, we will leave the Shading and Autocontrast options checked. Choose Spectrum for the Palette.

Press the Apply button in the toolbar to apply the palette to the Colors pane.

The result is a series of equal intervals colored by the palette colors. We will adjust these by manually clicking into each interval number and editing it to make it a round number.

The above intervals seem reasonable at first glance, as a casual effort to round the intervals automatically created for the Spectrum palette. However, note that whereas the automatically created intervals were exactly the same our casual rounding to the nearest five or tens place has created uneven intervals. Some intervals are five units apart (such as 20.00 to 25.00) and some intervals are ten units apart (such as 30.00 to 40.00). This is sloppy.

If we were more rigorous and creating this example for a paper for publication and not just as an example of how to operate dialogs, we would probably have used intervals that were exactly the same size. This would have involved some tinkering to get even intervals that were reasonably well rounded. For example, we might have used intervals of 8, 16, 24, 32, and so on, or we might have used 20, 25, 30, 35, 40, 45 and 50.

Press OK to apply the display options to the surface.

The result is that the surface is neatly colored. Dark blue colors indicate regions where most students finish high school. Yellow, orange and red colors indicate regions where very many students fail to finish high school.

If we show the new surface in a map overlaid by the drawing of data points we can see the relationship between the points and the surface created from them. Note how the surface cannot be completed in the Southwest because the allowed interpolation radius does not extend far enough to fill in the gaps between the sparse points in that region.

If we overlay a drawing of the United States (the US_Main.mfd drawing found on the Manifold CD, with area background set to transparent color) we can see that the interpolation extends beyond the geographic borders of the US.

Step 3: Trim Surface to US Boundaries

Although at this point we already have a perfectly functioning gradient map, as a matter of neatness and better presentation we will trim the surface so that it does not extend beyond the borders of the US.

We begin by showing a drawing of the United States (the US_Main.mfd drawing) in a map together with the surface.

We select all of the areas in the US_Main drawing clicking on its layer tab in the map and choosing Edit - Select All (or by pressing CTRL-A).

Next, we right click on the US_Main drawing layer tab and we choose Transfer Selection.

In the Transfer Selection dialog we choose Data Surface as the component to modify, using the US_Main drawing. Since this is the only component in our project that has a selection in it, it is the only component that appears in the Using pane. Press OK.

The selection will be transferred to the surface, as we can see by clicking off the US_Main drawing that overlays it.

To trim the surface we choose Edit - Select Inverse (or, press CTRL-I). This inverts the selection so that all pixels are selected except those that had been previously selected. Choose Edit - Delete (or, press the Delete key) to delete these pixels.

The result is a surface that has been neatly trimmed to the borders of the US.

To provide some context to our map we can turn on the US_Main drawing again, set the background color of areas in the drawing to transparent color and then change the foreground color to medium gray. We can then change the Opacity of the US_Main drawing to 50%. This will provide a faint overlay of state and US boundaries to provide context for the gradient map underneath.

To complete the map, we can add a legend, editing the values in the legend so that the numbers are not too long. See the Adding a Legend example topic for a step by step procedure for adding a legend.

This example used a collection of data points to create a gradient map. The data points used were US Census data from 1990 that gave the dropout percentage for each US county similar to what is in the counties maps on the CD such as Counties98_demog.map. To create the data points we simply took the centroid of each county within the continental US.

This is something of a contrived example that takes advantage of a handy data set. To display demographic data, such as the dropout percentage, that is collected on a per-county basis it might make more sense to use a thematic map like that shown in the Display Demographic Data in a Thematic Map topic.

If we thematically format a map of US counties with the same data and the same palette we can compare the visual effect of the thematically formatted drawing to that of the similarly colored gradient map.

In one sense, the drawing is more accurate because this particular data set was collected for each county. In another sense the gradient map surface is more accurate because human phenomena like populations and educational achievement do not suddenly change at the sharp boundary of a county. They are more likely to smoothly vary from place to place.

Gradient maps are typically used to show data arising from natural phenomena that are fundamentally continuously variable over a geographic region, so that one would see a smooth variation beyond the boundaries of just one county or one state. For example, temperatures, pollution, the percentage of ozone in the upper atmosphere or the distribution of algae in a region of an ocean are all cases where we would expect there to be some smooth variation between data points recorded. The technique described here works with all these cases.

The process is always similar: acquire the data points, noting the latitude and longitude at which each sample was collected. Collect the data points into a geocoded table. Create a drawing of points from the geocoded table and then create a surface and color the surface as desired. If desired, trim the surface neatly to whatever geographic boundaries are convenient for the area of interest.

Note that we could create the surface directly from a geocoded table by copying the table and pasting it as a surface. However, it is usually wise to create a drawing of points from the table first as a way of checking that the points really are in the region we desire (and no systematic error has occurred) by viewing them overlaid upon a drawing showing the area of interest.