Display Demographic Data in a Thematic Map

A frequent use of Manifold System is to display data on maps or drawings by coloring areas or points in a range of colors corresponding to the data values. Such a display is said to be thematically formatted and such maps are called choropleth or thematic maps.

 

Important: If you have installed 64-bit Manifold, do this example in 32-bit mode by launching Manifold System using the Manifold System (32-bit) shortcut. See the note on 64-bit Manifold at the end of this topic.

 

There is a huge amount of data available for download by Internet. In the case of the US, Manifold FTP sites and Census Bureau sites provide demographic data for US States, US Metropolitan Statistical Areas, and for the World by country. This data is very useful for the creation of thematic maps and for statistical analysis. In addition, numerous other sources on Internet provide downloads for vast amounts of statistical information.

 

Demographic data on the Internet is provided mostly in the form of database files, such as Access .mdb or dBase .dbf files. To create maps using this data, we follow a four step process:

 

·      Find and import an appropriate base drawing to display the data (such as the various world, US states or other drawings provided on the CD).

·      Import or link the table containing the demographic data of interest.

·      Add a relation to the drawing's table with the demographic table that makes fields of interest from the demographic table appear within the drawing's table.

·      Thematically format the drawing using fields of interest.

 

For the above process to work, the base drawing and the table containing the demographic data have to share at least one field in common that can be used as a key field. For example, if we want to display demographic data for each state in a drawing of the United States, both the drawing and the data table must each have a field that identifies the state (such as a state name field or two letter postal abbreviation).

 

In this example, we will use the States_thematic map and a table from the StatesVital.mdb database. Both of these files are located in the help examples folder on the Manifold CD. The example assumes you are familiar with basic Manifold concepts such as importing drawings and tables, adding relations and applying thematic formatting .

 

Step 1:Import the States_thematic drawing.

 

We begin by importing the States_thematic.mfd drawing into the project using File - Import - Drawing. Check all of the boxes to import all of the fields in the Import MFD File dialog.

 

images\eg_display_demographics_01.gif

 

The States_thematic drawing shows US States as areas, including a FIPS code for each state.

 

images\eg_display_demographics_02.gif

 

We can see the fields in this drawing's table by double clicking the table open in a table window.

 

Step 2: Import the demographic data table.

 

We import the StatesVital.mdb table into the table by choosing File - Import - Table. [If we desire a more dynamic link to the data, we could link the table using File - Link - Table - see the discussion at the end of this topic.]

 

When we open the StatesVital.mdb file we will see the Import MDB File dialog.

 

images\eg_display_demographics_03.gif

 

For this example we will import only one table by clicking on Death Rates by Leading Cause and pressing OK.

 

images\eg_display_demographics_04.gif

 

If we double click open this table after importing it we will see it is a very interesting table providing statistics on death rates from heart disease, cancer, accidents, motor vehicle accidents and many other causes of death for the various states. The rates are per 100,000 resident population in 1994.

 

images\eg_display_demographics_05.gif

 

So far we have imported a drawing and a table. If we look at the project pane we will see the States_thematic drawing with its associated table as well as the Death Rates by Leading Cause table.

 

Note that this table includes a FIPS field that contains values that match up to the FIPS field that is in the drawing's table. This is a very important observation, since we will be using the FIPS codes in the thematic states drawing to match the FIPS codes in the demographic data table.

 

Step 3: Add a relation to the States_thematic drawing's table.

 

Adding a relation to a table is simply adding a column to the table that is taken from a different table. To add a relation to the States_thematic Table, we click it open and then choose Table - Relations.

 

images\eg_display_demographics_06.gif

 

The Relations dialog for the table opens with no relations, since none have yet been added. We press the New Relation button to add a relation.

 

images\eg_display_demographics_07.gif

 

The Add Relation dialog asks us which fields will be used to match up records between the States_thematic Table and the new table from which we will bring in a column. In the pane on the left we choose FIPS as the field to use for the States_thematic Table. The combo box over the pane on the right allows us to choose which table will be used to supply fields for this relation. Since we have imported only one other table it is already loaded in the combo box. We choose FIPS in the pane on the right to use as the key field for the Death Rates table. Press OK. Note that it is a happy accident that the key fields on both sides have exactly the same name. The important thing is that the contents of the fields correspond.

 

images\eg_display_demographics_08.gif

 

Back in the Relations pane we now have a new relation added in the upper pane. This relation uses the FIPS field as a key to bring columns in from the Death Rates table using the FIPS field in that table as a corresponding key. The lower pane shows various cheerful columns available from the Death Rates table that we can bring into our States_thematic Table as relations.

 

We will check the Accidents and adverse effects rate box as well as the Cancer Rate, Cerebrovascular disease and Homicide (scrolled out of view in the illustration) boxes. Press OK.

 

images\eg_display_demographics_09.gif

 

Like magic, new columns such as Accidents and adverse effects rate column appear in the States_thematic Table. (If you don't see the columns, use View - Columns to click them on).

 

images\eg_display_demographics_09a.gif

 

We can see the columns better by using View - Columns to hide the other fields in the table and show only the state name field and the new columns. The new columns provide data from the Death Rates demographic table.

 

Step 4: Apply thematic formatting to drawing.

 

images\eg_display_demographics_01.gif

 

We click onto the drawing to move the focus there.

 

images\eg_display_demographics_10.gif

 

We will thematically format the drawing by changing the background ("fill") color of the areas. To do this, click on the area background color well.

 

images\eg_display_demographics_11.gif

 

In the pull down color menu, choose Theme.

 

images\eg_display_demographics_12.gif

 

The Format dialog launches with default values. We will change the default values by changing the choices in the Field, Method and Palette boxes. We will also check the Preview box so we can see a preview of the effects in the drawing window.

 

images\eg_display_demographics_13.gif

 

We choose the Accidents column in the field box and the Natural Breaks method. We choose Reds to Yellows as our color palette and press Apply. The resultant colors are nice, but since we are indicating death rates we would prefer to have redder colors indicate higher values.

 

images\eg_display_demographics_14.gif

 

Pressing the Reverse button reverses the colors so that redder colors are used for higher values. Press OK to apply the thematic format.

 

images\eg_display_demographics_15.gif

 

The resulting drawing shows how various states compare in terms of accidental death rates (excluding motor vehicle accidents). It's no surprise that states representing a frontier, outdoors lifestyle such as Alaska, Idaho, Wyoming and Montana have higher accidental death rates than do states with population concentrated in urban areas. However, why the cluster of high accidental death rates in the deep South? Why does New Mexico have a significantly greater rate of accidental deaths than Arizona? Could it be that a higher population of retirees in Arizona than in New Mexico skews mortality statistics away from accidental deaths?

 

To see the other demographic data we imported we can open the thematic format dialog and change the field used.

 

images\eg_display_demographics_16a.gif

 

For example, we could choose Cancer rate as the controlling field and press apply (and then also press Reverse to reverse the present color range) to see the states colored by cancer rates.

 

images\eg_display_demographics_16.gif

 

This is a very interesting drawing. Note that Utah is exceptionally low in cancer rates while the Rust Belt, Appalachia and the southern regions feature high cancer rates. As expected, Florida has high rates as well, perhaps from the high percentage of older residents. We’d bet that this map would be very similar to a map created of smoking rates per 100,000 citizens. Note that Utah has a high percentage of Mormons who as a statistical cohort tend to show a bias against smoking. Both West Virginia and Pennsylvania have high cancer rates, no doubt due to the higher percentage of persons occupied in coal mining in those states. An anomaly: why the higher cancer rates in Maine?

 

images\eg_display_demographics_17a.gif

 

Finally, we will look at death rates by homicide (murder). To do so we open the Format dialog one more time and choose Homicide rate as the controlling field, press Apply and then press Reverse.

 

images\eg_display_demographics_17.gif

 

The Natural Breaks algorithm assigns states to intervals based on clustering of homicide rates. The drawing shows a classic observation, that increased homicide rates are correlated with warmer weather. New York state and the District of Columbia (the seat of Federal government in the US, too small to be seen in this zoomed out view) are clear exceptions.

 

The States_thematic Drawing

 

For the convenience of users, we have provided the States_thematic drawing that shows Alaska and Hawaii in the same view as the lower 48 US states. Here is how it was created:

 

1. Project the States map into Lambert Conformal Conic projection using an origin approximately in the center of the US.

2. Move Alaska and Hawaii next to the lower 48 states.

3. Resize Alaska to reduce the size (using the Scale transform) and rotate it counter clockwise about 28 degrees (using the Rotate transform).

4. Resize Hawaii to enlarge it (using the Scale transform) and rotate it about 30 degrees counter clockwise.

 

This drawing is useless for serious measurement since Alaska and Hawaii have both been re-scaled and moved, but it does provide a handy drawing for presentations. Just make sure to note somewhere that Alaska and Hawaii are not shown to scale!

 

Using drawings such as the States_thematic drawing which take geographic entities and apply crafty GIS tricks to move them into different locations and scales within what is purportedly a "real" projection is in some respects an amateur hack, beloved though it may be for expediency even by professionals. Sometimes it is best to simply cringe, clench our teeth and just do what works quickly.

 

A more elegant and rigorous way to accomplish a presentation like that of the States_thematic drawing is to use a print layout that has different views in play as elements in the layout. Even within an IMS application we can code a web page that uses frames to show multiple IMS views of multiple maps that contain the same drawing, but with different views or projections used so that the continental US as well as Alaska and Hawaii can all be present on the same page.

 

Discussion

 

This example explored a few fields from one table out of many thousands of fields available. The same methods may be used to explore demographic data downloaded from the Manifold FTP site or from other web sites, such as the Census Bureau's web site. For example, from the Manifold FTP site we can get and explore the WorldData.mdb database of world demographic data in conjunction with the World_demographic drawing. All of the tables for world data are in the one WorldData.mdb database file.

 

Note: Manifold FTP sites (drill down through the Manifold web site to find them) require an FTP client that can autoswitch between PASV and non-PASV modes. Ordinary browsers usually won't work, so acquire and learn to use a dedicated FTP transfer program. See the notes on the Manifold web site for more about using FTP.

 

This example imports an Access .mdb table to keep all parts of the example conceptually simple and as transparent as possible for new users. After all, most Microsoft Office power users know all about how to create a new Access table and save it in an .mdb file. It would be just as easy to import or link a table from some other data provider, such as a table within an SQL, Oracle, IBM DB2, MySQL or other more sophisticated database system.

 

A more advanced approach than importing the table would be to link the table into the project to be able to exploit the dynamic properties of linked tables within the project. See the Importing and Linking Tables topic for information on linked tables. If the table were linked, then any change in the external database file or system that provided the table would be automatically reflected in the linked table. For example, suppose the table came from a SQL Server table that gave the total number of automobile accidents per state for the previous week. If we linked the table and then formed a relation between our drawing's table and the linked table, any change in the external SQL Server table would automatically be updated in the drawing as well.

 

We could exploit this by, for example, creating a Manifold IMS web site that showed a thematic map of the United States showing the rates of automobile accidents in the preceding week, where the data to color the map would be automatically taken from the originating SQL Server table. As our other programs or user interfaces updated the SQL Server table the Manifold IMS display would always be automatically up to date as well.

 

Tech Tips

 

Be alert to possible problems when using fields as key fields to form relations. Tables may store information differently than expected. For example, the FIPS codes are stored as text strings in both the States_thematic Table and the StatesVital database even though they are numbers. The text string "35" is not the same as the text string "00035" or as "35.0" even though humans would read all three text strings as the same numeric value. Manifold, however, would not be able to match the string "35.0" to the string "35" in the automated key field matching process. If your drawings and databases use inconsistent representations change the types of the fields to match. You may also have to use Transform toolbar operations to alter field contents into compatible form.

 

The States_thematic Table has FIPS codes in the "concatenated" format favored by the US Government for use when States and Counties might be in the same database. These are five character codes where the first two characters give the state FIPS code and the last three characters are significant for the county within the state. Therefore, "23000" is the FIPS code for Maine and "23003" is the FIPS code for a county within the state of Maine.

 

One often encounters State FIPS codes in non-concatenated form. In such instances, the FIPS code for Maine is 23, not 23000. A further complication is that Federal databases often express the FIPS code as a text string and not as an integer. Finally, Federal databases often utilize FIPS codes for countries that are multiplied by 100 and also contain extra leading "0" characters. All of these issues may arise when one combines data and maps from various sources. Each may be easily dealt with through the use of the Transform toolbar or the Convert Type command in the table column head context menu.

 

How to produce leading zeros with the Transform toolbar? Suppose we wish to create text "numbers" like "00035." Start with an integer field. Add a large multiple of ten (say, 1,000,000) to that field. Convert the integer field into a text field. Cut off as many starting characters as desired, leaving as many leading zeros as desired.

 

Important Note when Using 64-bit Manifold Editions

 

Due to a lack of required Microsoft facilities in 64-bit Windows systems, Manifold in 64-bit mode cannot export, import, export or link to DB, HTML, MDB, XLS or WKx format files. This includes no access to the MDB parts of Manifold MFD and MapInfo TAB imports. The workaround for importing or exporting such files is to launch Manifold in 32-bit mode by using the Manifold System (32-bit) shortcut, perform the export from or import into a .map project file and then re-launch Manifold in 64-bit mode using the Manifold System (64-bit) shortcut. Linking is more complex: the data must be in some format usable in 64-bit mode within 64-bit Windows systems, such as a SQL Server database. Alternatively, the data can be kept within a Manifold .map project file and linked using the Manifold ODBC driver.

 

See Also

 

See the Color topic for fast "four-color" coloring of drawings.

 

Thematic Formatting Example

Thematic Formatting and Labels