# Chapter 27 Maps

We will eventually have more here about maps, but here is a start.

If you click on the Map icon in the toolbar, a world map appears. You can display locations and areas on maps.

Locations appear as points; to have a point, the case must have two attributes, one for latitude and one for longitude. These are measured in degrees. Typically, a west longitude is negative, so, for example, San Francisco is at about -122.

Areas are regions on the map, for example, countries or States. You could easily encounter a CODAP document with areas all set up; then, if you drag an attribute into the map, the regions will color according to the value of the attribute, just as points do in regular graphs.

The tricky thing is when you want to set up a CODAP document with a map on your own.

## 27.1 Setting up Boundaries for CODAP Maps: the simple case

As an example, here is a picture of a case card from a dataset about vehicle use by State. We have selected Oregon, so you can see its values:

If you have a dataset with a column that has the names or IDs of some common boundary type—let’s say US States, as in our example—and you drag an attribute into the map, nothing happens.

The problem is that our document does not have the boundaries in it. Here is how to fix that:

1. Make a new attribute and name it boundaries.

2. Open up the formula editor for your new attribute.

3. You need a special function. Under —Insert Function–, choose the Lookup functions section.

4. Choose lookupBoundary. You will see this:

As you can see, there are two arguments: boundary_set and boundary_key. For boundary_set, you need a special name, which you may not remember.

1. Select boundary_set and open the —Insert Value— menu. The lower part of that list has special names such as $$\pi$$—and also the various boundary sets that are currently installed. For our example, choose US_state_boundaries. (You can type it in if you like; CODAP will help with typeahead.)

2. Finally, replace boundary_key with the name of the attribute that has the “key,” in this case, the one that has the names of states in it. In our case, this is State.

Now, if we drag VehicleMilesTraveled into the map, we see this:

Note: The State attribute does not have to have the full name of the State in it. Attributes with the standard two-letter postal abbreviation work too.