Geography 387 – Fall 2011

Lab 3

Working with Attribute Data

Lab 3: Working with Attribute Data 1.0 Overview In this lab you will strengthen your ArcGIS skills from previous labs and begin to work with attribute data. The overall steps of this lab are:            

Download GIS data from a public website Read the metadata for the data Define the correct projection for the data Create a geodatabase Import the data into that geodatabase. Look at the attributes Project the data Select features with queries Export selected features to the geodatabase Add fields and calculate values for them Create a map with classified color scheme (a choropleth or thematic map) Create a graph based on the attribute data

Geography 387 – Fall 2011

Lab 3

Working with Attribute Data

2.0 Get the data Make a Lab 3 work folder in your workspace (on your USB drive or local drive). Then go to the following web site: http://nationalatlas.gov/

Geography 387 – Fall 2011

Lab 3

Working with Attribute Data

The webpage may look different than the screenshot above because the National Atlas is a dynamic site, which changes its "What's New" section regularly. Click on the "About" link below the search window at the top. Read through the description of the National Atlas and answer the following question.

Question 1: (1) a. When was the first National Atlas published? b. Before this digital version of the National Atlas was released on the Internet, when was the last update to the National Atlas? You are now going to download a GIS layer from the National Atlas site. Click on the "Mapping Professionals" in the dark blue bar at the top right. Read the information about "Raw Data" and "Raw Data Documentation". Now answer the following question:

Question 2: (2.5) a. What formats do Vector files come in? b. What format do geostatistical data (additional attributes) come in? c. What format do Raster image data come in? d. What standard was used to create the metadata? e. Does metadata come with the raw GIS data files? You are now ready to download the raw GIS data layer from this site. First click on "Raw Data" icon.

You will see a list of chapters, such as: Agriculture, Biology, Boundaries, etc. These chapters are used to group raw data into sets. Go to the Boundaries chapter. Several GIS layers are available for download. Each layer occupies a row in the table. Locate the "County Boundaries, 2001" row in the table. Find the column that has the link to the download and right-click on the link to the compressed shapefile, select "Save link as..." and navigate to your Lab 3 folder and save the download file there. This will download the shapefile in a compressed (Gzip) format. Note: if the National Atlas server does not respond, then just click here to get the data archive.

Question 3: (2) a. Beside "County Boundaries, 2001" name 3 other layers that you could download from the Boundaries theme. b. What is the compressed and decompressed size of the Boundaries, 2001 data?

Geography 387 – Fall 2011

Lab 3

Working with Attribute Data

3.0 Setting up the data in Catalog Unzip the contents of the downloaded file archive to your Lab 3 folder with 7Zip. This is a 2step process: You will have to uncompress the “.gz” file first, and then run 7Zip again to extract the files from the “.tar” file. Ask your TA for help if needed. In Windows File Explorer, navigate to the Lab 3 directory and look at the list of files – you should see th files that make up a shapefile. Open ArcMap and establish a folder connection to your Lab3 working folder.

Use the Item Description to preview the geographic and table information for the countyp020 shapefile.

Question 4: (2.5) a. Using Windows File Explorer, how many files were contained in the downloaded file archive? b. Using ArcMap, is there a defined projection or coordinate system associated with this shapefile? What evidence do you have for your answer? c. How many columns are there in the Shapefile’s attribute table? d. What does each feature (i.e., row) of this layer represent? e. How many features (i.e., rows) are there in the table? From the Catalog, in the Properties window of the shapefile, select the Field tab. You will see the names of all the fields (columns) in the shapefile's attribute table. Close the Properties window. You should have noticed in the Description tab that none of the description fields were filled in. The metadata for this shapefile is in a separate file that came with the raw data. You should see this file appear in the catalog tree with the shapefile, but with a this file, it should open up as an ASCII text file in Notepad.

icon. If you double-click on

Explore the metadata to answer the following questions:

Question 5: (1) a. At what scale is this data intended to be used? b. What U.S. Geological Survey (USGS) digital product was used as the source of this layer?

Geography 387 – Fall 2011

Lab 3

Working with Attribute Data

Look for the metadata section entitled "Spatial_Reference_Information" and answer the following question:

Question 6: (4) According to the metadata: a. What are the units of the data? b. Is the Shapefile in a Projected Coordinate System (PCS) or in Geographic Coordinate System (GCS)? c. What is the datum? d. What is the ellipsoid? The projection for this data needs to be defined. Using the information from Question 6, and your skills from Lab 2, you will proceed to define the projection. But first... You are not going to import the projection/coordinate system information from another feature. Instead, you will select a predefined coordinate system. Click on “Select” in the “XY Coordinate System” tab of the shapefile properties and navigate to the "North American" folder under projected or geographic coordinate system (whichever is appropriate…you have the necessary information to answer this). Now find a "North American Datum" (NAD) that matches your datum in Question 6c. There are various versions of this coordinate system available, use the ‘plain’ one. Apply this coordinate system. Think: are you applying a PCS or a GCS? This will create a ".prj” file for your Shapefile. You can see this file in Windows File Explorer. Be sure you can locate this in your working directory as this is one of the lab deliverables. For the last step of preparing the downloaded GIS data in Catalog, you will create a file geodatabase and load this shapefile into it. In the Catalog window, right click on your Lab 3 working folder (you should have a folder connection to this folder). Select “New” and then select “File Geodatabase”.

Geography 387 – Fall 2011

Lab 3

Working with Attribute Data

ArcMap creates the geodatabase and gives it the name “New File Geodatabase”. Rename this geodatabase to something more appropriate, perhaps “Lab3” or “US_counties” In the Catalog window, right click on the shapefile, (not the geodatabase), and select “Export” and then “To Geodatabase (single)...”.

The dialog box for an ArcTool called “Feature Class to Feature Class” opens up. It has the value for “Input Features” already filled in with your shapefile you right-clicked. For “Output Location”

Geography 387 – Fall 2011

Lab 3

Working with Attribute Data

select the geodatabase you just made in the previous step. For “Output Feature Class” give the feature an appropriate name, like “countyp020”

Notice, the fields from the shapefile are listed in the “Field Map”. Click on “OK”, and then watch your computer screen closely, near the lower right, and wait a second or two. ArcMap runs tools in the background. If, for instance, you were running a tool that took a long time to run, ArcMap will let you do other tasks with your map while the tool works in the background. ArcMap will pop up a small notice when the tool has completed running to let you know that it’s done. Did you see your tool finish? You should notice a few things now: 1. Your new geodatabase feature class is loaded into TOC of your map. You should look under the “Source” tab of the feature’s Property window (from the TOC) to verify that the data being drawn in the map is the geodatabase feature class, not the shapefile. 2. In the Catalog window, if you expand your geodatabase, you’ll see the feature class that was imported from your shapefile. 3. The Coordinate System of your data frame should be set to the coordinate system you defined for the shapefile.

Geography 387 – Fall 2011

Lab 3

Working with Attribute Data

4.0 Selecting attributes in ArcMap You will now explore working with attribute tables in ArcMap. You should have a map with the geodatabase feature loaded in and displayed and zoomed out to full extent.

For the purpose of this lab, you are only going to focus on the 48 conterminous states. You will create a new feature class in the geodatabase by first selecting the 48 states. You can do this by opening the countyp020 feature class attribute table from the TOC. Click on the “Table Options” icon in the upper left corner of the Attribute Table window and select “Select by Attributes...”

Geography 387 – Fall 2011

Lab 3

This should open the “Select by Attributes” dialog box:

Working with Attribute Data

Geography 387 – Fall 2011

Lab 3

Working with Attribute Data

Using your notes and the lecture presentation on attribute data, build a query to select the polygons of the 48 conterminous states. For the “Method” use the default "Create a new selection". You can double-click the appropriate field name in the upper area to get it to appear in the SELECT window (the lower area). Once you select a field, you can press "Get Unique Values" to show all possible values for that field. Do not click Apply just yet. You will need a combination of Set Algebra (i.e., =, , ) and Boolean Logic (i.e.., AND, OR, NOT). It is easiest to build your query by selecting all polygons that are not conterminous states (Alaska [AK], Hawaii [HI], Puerto Rico [PR], and the Virgin Islands [VI]). Also exclude from your selection any polygon that does not have a county name (use "COUNTY" ' '). You will include the state of “DC” (so there are really 49 states selected). You can save your query with the "Save..." button. Select the text in your query and do a right-click then "copy". Paste your query into the follow question box in your answers:

Question 7: (2) What is your query statement? (paste it into your answer document)

Geography 387 – Fall 2011

Lab 3

Working with Attribute Data

Go ahead and click the Apply button. You should see polygons from the 48 conterminous states highlighted in light blue. Be sure that there are no polygons selected in the Great Lakes (polygons with no county name). If you did not get the query right, go back and try another query. You can always bring in a saved query by clicking the "Load..." button in the query window.

Now you can export the selected polygons to a new feature. Go to the “Export Data” dialog box for countyp020 feature class in the TOC (remember Lab2?). Set the output feature class to an appropriate name in your geodatabase for Lab 3. Note that “Export” is set to “Selected features”. This is a way to extract the features you select so that they are the only features in the new feature class. You will use the "layer's source data" coordinate system.

Question 8: (2) a. What will the output coordinate system be for the exported feature class? b. What would be the coordinate system be if you chose the "data frame" option?

Geography 387 – Fall 2011

Lab 3

Working with Attribute Data

After you click "OK" to export the data, when ArcMap asks if you want to add the new data to your map, click “Yes”. You no longer need the countyp020 feature class, so remove it from the TOC of the map. (Do not remove it from the Catalog.) Zoom the data frame to the extent of the new 48-state feature class by right-clicking on it in the TOC and selecting "Zoom To Layer".

Geography 387 – Fall 2011

Lab 3

Working with Attribute Data

5.0 Calculating and Displaying Area You now are going to make a map that displays the area of each State. Do not display the area values in the units of the feature (what are those units? See Question 6a.). Area in square units of the current coordinate system does not make much sense. Remember from Lab 2 that you can calculate the area in convenient units, like square meters, by projecting the layer to a projected coordinate system. Remember how you did that? In Lab 2, you reprojected the feature class by changing the data frame and then selecting "the data frame" option for the output coordinate system in the data export dialog. But wait! There is an easier way to reproject a vector feature class. You can use a tool in ArcToolbox! Open up the ArcToolbox window (or you could go under “Toolboxes” in the bottom of the Catalog tree). Look in "Data Management Tools", then "Projections and Transformations", then "Feature", then select the "Project" tool. (DO NOT use the "Define Projection" tool - that tool defines the coordinate system information if it was missing, like you did in Step 3).

So, now you know two ways to project data: ● The Data Frame & Export Data method (as done in Lab 2) ● The ArcToolbox “Project” tool Either of these projection methods will give you a projected feature class. Chose a method and project your feature class to the "USA Contiguous Albers Equal Area Conic" projection -- the same projection used in Lab 2. An appropriate name for the newly projected feature in your geodatabase could be “county48_albers”. (If you use the tool in ArcToolbox, remember that ArcMap runs tools in the background.) You now need to calculate the area of the States like you did in Lab 2 -- but there is one problem. You do not have State polygons. Instead you have polygons representing subdivsions of States (see Question 4d). The polygons in this feature will need to be “glued” together by State and the interior boundaries between polygons “dissolved”. This process will give us polygons representing states. You can do this with a very useful tool called "Dissolve". Open this tool in ArcToolbox. It is under "Data Management Tools", then "Generalization". Read the help to the right of the tool window to get a better understanding of the process (click “Show

Geography 387 – Fall 2011

Lab 3

Working with Attribute Data

Help >>” if the help is not visible). When you are ready, use your Albers-projected feature class as the input and give your output feature class an appropriate name. Use the "State" field as the "Dissolve_Field". Make sure that “Create multipart features” is checked.

Open the dissolved feature class attribute table.

Question 9: (3) a. How many fields are there in the dissolved feature class attribute table? b. What are they named? c. Which fields from the counties feature did not get copied to the dissolved feature? Create a new blank map in ArcMap and load in the Albers-projected states. You do not need to save the old map. You will now calculate the area for each polygon. First you need a new field to hold the area calculation. Open “Table Options", then "Add Field". Type in "Area" for the Name and select

Geography 387 – Fall 2011

Lab 3

Working with Attribute Data

"Double" for the Type. Click "OK". This adds a new field to the table with double-precision numbers (allows decimal precision). Use your skills from Lab 2 to calculate the Area field in the attribute table. Calculate area in square meters. Make another field, but this time name it "Hectares" and set its field Type to "Long Integer". Calculate the area for each polygon in hectares. Remember that the Area column has units of square meters (m2) and there are 10,000 m2 per hectare. The calculation is done by selecting the new Hectares column and then opening Field Calculator. Double-click "Area" in the fields window and then in the white window below the "Hectares =", type in "/ 10000" after the "[Area]". Then click "OK".

Geography 387 – Fall 2011

Lab 3

Working with Attribute Data

You should have a new column with the area for each polygon in Hectares. Notice how the hectares values are rounded to the nearest whole integer. This is because you chose "Long Integer" as the field type, rather than "Double", which is a floating point data type with decimal precision.

Question 10: Extra Credit (+2) What is an alternative method for calculating the Hectares of each polygon without using the Field Calculator?

Geography 387 – Fall 2011

Lab 3

Working with Attribute Data

6.0 Make a Classified Map of State Area Go to the Symbology tab of the dissolved states feature class. Select "Quantities", then "Graduated Colors". Select the "Hectares" field for Value. Click on the "Classify" button and chose "Natural Breaks" for Method. Notice that the classify window has statistics (e.g., minimum, maximum, mean, etc.) and a histogram with class break points. Change the color ramp to a color scheme of your choice. You should experiment with the other methods for determining the classification breaks (divisions between classes). You will learn more about map classification in the next lab.

Map 1 (8) Make a map of the 48 conterminous with 5 classes and Natural breaks based on the Hectares field. Chose a color scheme that clearly shows the difference among the different area classes. Be sure to include a title, legend, scale bar, north arrow, your name, etc. Refer to the cartography guidelines from Lab 1. Export the map to a PDF file with 150 dpi. Name the filename with your _lab3_map1.pdf

Geography 387 – Fall 2011

Lab 3

Working with Attribute Data

7.0 Create a Bar Graph of State Area Finally, you are going to learn the Graph tool in ArcMap. This tool allows you to make graphs of the data in an attribute table, much like you would do in Excel. In this exercise you will make a bar graph of state area in hectares. Go to "View" in the main tool bar of ArcMap, then "Graphs", then "Create". Adjust the parameters so that they match the screenshot below. As you change parameters, notice how the graph in the right side of the window is affected. You can choose any color scheme that you want, but match the other parameters to this example. Obviously, the name of the Layer/Table would be the name of your projected and dissolved feature class. Here the color scheme is set to match the color scheme of the symbolized layer in the map.

Click “Next”

Geography 387 – Fall 2011

Lab 3

Working with Attribute Data

Change the title of the graph to something reasonable, for example "Area of the 48 Conterminous States". Match the rest of the parameters as shown in the screenshot, but take notice of what those parameters do.

When you are done exploring, select "Finish". Notice that the graph appears as a floating window that cannot be docked. Also, the Y-axis labels skip a lot of states. You need to change this so that every state is labeled. First start by stretching the graph window so that it is taller than the default height, as shown below. The exact size does not matter, but you want to make room for all the extra labels.

Geography 387 – Fall 2011

Lab 3

Working with Attribute Data

Now right-clicking on the graph and select "Advanced Properties...". Click the + next to Axis to open the Axis properties. Select the "Left Axis" (Y-axis), then select the "Labels" tab, then set the minimum label separation to 0%.

Geography 387 – Fall 2011

Lab 3

Working with Attribute Data

Feel free to explore the Graph Wizard's advanced parameters. You will find that there are many ways to make your graphs look professional and customized for your particular needs. When you are done exploring, click "Close".

Geography 387 – Fall 2011

Lab 3

Working with Attribute Data

You may be able to adjust the size of your graph's window to make it compact and still see all the information properly. When you are have sized your graph, right-click in the window and select "Export". Export the graph to a JPEG (JPG) image format.

Click "Save..." button to save your graph image file to your Lab 3 directory, giving it an appropriate name (with your last name first). Then click “Close”. This graph image file is a deliverable from this lab. You can also save the graph in a way that lets you change its settings later in ArcMap. Right click in the graph’s window and select “Save...” Save the .GRF file in your Lab 3 directory (along with your map document). You will now be able to close the graph window, and then reload the graph and adjust all its settings with “View” → “Graphs” → “Load”. You can also insert the graph into the page layout of your map. Right click in the graph’s window and select “Add to Layout”. The graph then is part of the layout view of your map’s page. If you also go to the Size and Position tab of the graph’s Properties and uncheck "Preserve Aspect Ratio" you will be able to change the proportions the of graph in the layout so you can control its position and size.

Geography 387 – Fall 2011

Lab 3

Working with Attribute Data

8.0 Conclusions In this lab you learned how to download data from a web page with GIS data, explore and define its coordinate system, and the purpose of reading metadata. You created a new file geodatabase and imported a shapefile into it. You also learned how to extract a subset of the data with an attribute query and then export the selected set to a new geodatabase feature class. From there, you used ArcToolbox to project the new layer to a projected coordinate system. You also learned how to generalize a layer’s geometry by dissolving. Next you added new fields for holding the values of custom calculations. Finally, you created a classified map and bar graph from your calculated values.

9.0 To turn in ● ● ● ●

Your answers to the 9 questions (10 with extra credit) in a Word document (20) your projection file for countyp020 (countyp020.prj) (6) map of the 48 states area with a natural breaks color classification (pdf format). Do not include the graph in the map. Do not send the .MXD file. (8) the file of the exported graph of the 48 states area (jpg image format) (6)

Submit electronic files via email to your instructor, with the subject "G387, Lab 3, [your last name]". Remember to put your last name before each file name (e.g., clark_county020.prj). We will deduct 0.5 points for each file not properly named. Be sure to save all of your work from this lab in a safe place! It will be used in future labs.

Credits: The original version of this lab module was developed for instruction at Sonoma State University by Matthew Clark and expanded for ArcGIS 10 by George Riner, Center for Interdisciplinary Geospatial Analysis (CIGA).