+ All Categories
Home > Documents > SpatialStatistics ModelBuilder Tutorial

SpatialStatistics ModelBuilder Tutorial

Date post: 13-Apr-2015
Category:
Upload: misael-barreto-aranda
View: 28 times
Download: 2 times
Share this document with a friend
14
Model Builder Exercise This exercise will use CDC Wonder Data and Model Builder to create yearly hot spot maps of Heart Disease. You will: (1) download CDC Wonder Heart Disease data for the Southern United States by County; (2) bring the data into an ArcGIS file geodatabase; (3) create a model to process the data into individual feature classes, one for each year; (4) create a second model to perform hot spot analysis on each year’s feature class; and (5) animate the yearly hot spot feature class maps. Estimated time: 1 hour. Software: ArcGIS 10.0. (1) Download the CDC Wonder Heart Disease data http://wonder.cdc.gov Mortality -> Underlying cause of death -> 1999 2006
Transcript
Page 1: SpatialStatistics ModelBuilder Tutorial

Model Builder Exercise

This exercise will use CDC Wonder Data and Model Builder to create yearly hot spot maps of

Heart Disease. You will: (1) download CDC Wonder Heart Disease data for the Southern United

States by County; (2) bring the data into an ArcGIS file geodatabase; (3) create a model to

process the data into individual feature classes, one for each year; (4) create a second model to

perform hot spot analysis on each year’s feature class; and (5) animate the yearly hot spot

feature class maps. Estimated time: 1 hour. Software: ArcGIS 10.0.

(1) Download the CDC Wonder Heart Disease data

http://wonder.cdc.gov

Mortality -> Underlying cause of death -> 1999 – 2006

Page 2: SpatialStatistics ModelBuilder Tutorial

In the CDC Wonder Application:

Fill out the 1999-2006 Request Form using the following settings for each section of the form:

1. Organize Table Layout:

a. Group Results By: County AND BY Year

2. Select Location:

a. Choose to group by Regions

b. Choose Census Region 3: South

3. Select Years and Demographics: Accept Defaults

4. Select cause of Death:

a. Switch to the Search Tab

b. Search for Heart Disease (matches will be highlighted in BLUE)

c. Select all of the causes of death highlighted with blue. Use Ctrl+Click to select each one,

but ONLY select entries that are fully expanded (do not select any that have the “+” sign

or “-“ sign in front of them

5. Select Injury Intent and mechanism: Accept defaults

6. Select Rate Options: Accept Defaults

7. Other options:

a. Check on the Export Results option

b. Uncheck the Show Totals options

8. Press Send, choose to Open the file (the file should open in Notepad or Wordpad)

9. Go back to the browser, Cancel the request (since it is finished), and close the browser

In Notepad

1. For each of the column headings (on the first line of the text file), delete all spaces within field

names (County Code = CountyCode, Year Code = YearCode, Crude Rate = CrudeRate)

2. Go to the bottom of the text file, and delete ALL of the text that is not part of a column

3. Save the text file as HDSouth.txt (in c:\SpatialStats\ModelBuilderExercise, for example).

Page 3: SpatialStatistics ModelBuilder Tutorial

In ArcMap

1. In order to ensure that you are working with Projected Data (VERY important when using the

Spatial Statistics tools), you will first set your Output Coordinate System

a. Go to the Geoprocessing Menu>Environments

b. Press the Output Coordinates dropdown, Choose the “As Specified Below” option for

the Output Coordinate System, choose to browse for a coordinate system , then

choose to Select your coordinate system

c. Choose >ProjectedCoordinateSystems>Continental>NorthAmerica>USAContiguous

Albers Equal Area Conic, press “Add”, then “OK”

2. In this step you will create a Geodatabase and 2 Feature Datasets. These will help you keep

your input data, results, and other data organized throughout the analysis process.

a. In the Catalog Window, right click on the folder where your text file is located, go to the

New option, and choose to create a new File Geodatabase. Name your Geodatabase

CDCWonderAnalysis. Right click your new geodatabase and choose to make it your

Default Geodatabase.

Page 4: SpatialStatistics ModelBuilder Tutorial

b. Right click on your new geodatabase, go to the New option, and choose to create a new

Feature Dataset. Name your new Feature Dataset “YearlyData”. For the coordinate

system, use the USA Contiguous Albers Equal Area Conic (just like the output coordinate

system you set earlier). Accept all other defaults, click Finish.

c. Create a second Feature Dataset (the same way you created YearlyData above). Name

this one “HotSpots”.

3. These next steps will bring the CDC Wonder Text File into ArcMap and get it ready for analysis

a. In the catalog window, navigate to the location where you saved your text file, right click

it, and choose to Export it To Geodatabase (single)

b. Choose your geodatabase as the output location, and name your new table

HeartDisease_South. Then in the Field Map delete unnecessary fields one by one,

including Notes, YearCode, and CrudeRate. Click OK to run the tool.

Page 5: SpatialStatistics ModelBuilder Tutorial

c. Right click on the HeartDisease_South table that has been added to ArcMap and Open

d. From the options menu in the table window, choose Add Field, name your new field

HD_Rate, make it a float, and click OK

e. Right-click on HD_Rate field, choose Field Calculator. Double-click on the Deaths field

from the list of fields, then choose the division operator (/), then double-click on the

Population field (see below); click OK. You now have heart disease rates for each

county. Close the table.

Page 6: SpatialStatistics ModelBuilder Tutorial

4. Next you need the county features.

a. In the catalog window, navigate to the location where ArcGIS is installed (by default this

is C:/Program Files/ArcGIS). In this folder, find

Desktop10.0\TemplateData\TemplateData.gdb\USA\counties.

b. Right click on counties, and select Export it To Geodatabase (single)

c. Choose to save to your CDCWonderAnalysis geodatabase as “CountyData”, and click

“OK” to run the tool.

Page 7: SpatialStatistics ModelBuilder Tutorial

5. Add a Unique ID field to the County feature class.

a. Right-click on CountyData in the table of contents, Open the Attribute Table, then go to

the table menu and choose to add a field – call it UniqueID, and set the type to Long

Integer; press ok.

b. Right click on the new UniqueID field, choose Field Calculator, and then set the values to

the OBJECTID field (double-click on the OBJECTID field, then press OK). Close the

attribute table.

6. Save your MXD in the folder with your exercise geodatabase. Close ArcMap.

7. Reopen your MXD in ArcMap and use the Zoom tool to focus in on your Southern United States

study area.

8. Next you are going to create a spatial weights matrix file to use when you run hot spot analysis.

a. In the spatial statistics toolbox, under the Modeling Spatial Relationships toolset, open

the Generate Spatial Weights Matrix tool. For Input Feature Class, navigate to the

CountyData feature class, choose the UniqueID field that you created, choose a location

for your output Spatial Weights Matrix (in the folder with your geodatabase) and call it

SpatialWeightsMatrix_8Neighbors, choose K_Nearest_Neighbors for the

Conceptualization of Spatial Relationships, and for Number of Neighbors choose 8,

uncheck row standardization, and press OK

9. Use the Zoom tool to focus in on your Southern United States study area.

10. Save your work again (and save frequently).

Page 8: SpatialStatistics ModelBuilder Tutorial

Create a Model to Split your Data into Yearly Feature Classes

1. Open ModelBuilder

2. Set up an iterator to process records year by year:

a. From the Insert menu, go to Iterators, and choose the Row Selection Iterator

b. Double click on the iterator, and choose your HeartDisease_South table as your input,

and choose the Year field as the Group By Fields

3. Create an individual feature class for each year:

a. From the Search dialog, search for the Copy Features tool (Data Management toolbox),

and drag it into the ModelBuilder window

Page 9: SpatialStatistics ModelBuilder Tutorial

b. Double click on the Copy Features tool to open the dialog. Actually navigate to

CountyData in your file geodatabase and select this as your Input features. You’ll use

an INLINE Variable to name your output feature class. Within the YearlyData feature

dataset you created, set the output feature class name to HD_Rate_%Value%. The

“%Value%” part of the name is derived from the Iterator tool. For each iteration, VALUE

is set to a year and used to create a selection set of heart disease records. For example,

on the first iteration, VALUE is 1999 and the selection set includes all records associated

with 1999. On the next iteration, VALUE is set to 2000. The entry for Output Feature

Class should look something like this:

…\HeartDisease\CDCWonderAnalysis.gdb\YearlyData\HD_Rate_%Value%

4. Join your CDC Wonder data with the County feature class:

a. From the Search dialog, locate the Join Field tool (Data Management), and drag it into

the ModelBuilder window

b. Use the connector tool to connect the output from the Iterate Rows tool (the output

dataset, not the VALUE) to the Join Tool as the Join Table.

c. Use the connector tool again to connect the output from Copy Features to the Join Field

tool, as the Input Table.

d. Double click on the Join Field tool to expand the dialog.

e. For the Input Join Field, choose the FIPS field from the county dataset, and for the

Output Join Field, choose the CountyCode field from the CDC Wonder dataset

f. Choose to Join the HD_Rate field

Page 10: SpatialStatistics ModelBuilder Tutorial

5. Validate the Entire Model

6. Create a toolbox and save your new model:

a. Click the Save icon. Navigate to your geodatabase, and use the New Toolbox button to

create a new toolbox…give it a meaningful name (CDCWonderTools). Double click on

the new toolbox to open it. Choose a meaningful name for your new Model

(CreateYearlyFCs), and click Save.

7. Run Entire Model

8. Navigate to your YearlyData Feature Dataset and notice you’ve created 8 new feature classes.

Page 11: SpatialStatistics ModelBuilder Tutorial

Create a Model to Run Hot Spot Analysis for each Yearly Feature Class

1. Open a new ModelBuilder canvass

2. Create an iterator to process each yearly feature class:

a. From the Insert menu, go to Iterators, and choose the Feature Classes Iterator

b. Double click on the Iterate Feature Classes iterator to expand the dialog. For the

Workspace or Feature Dataset parameter, navigate to your YearlyData feature dataset

in your geodatabase, and click OK

3. Add the Hot Spot Analysis tool.

a. In ArcToolbox, in the Spatial Statistics toolbox, navigate to the Hot Spot Analysis (Getis-

Ord Gi*) tool in the Mapping Clusters Toolset, and drag the Hot Spot Analysis tool into

ModelBuilder

b. Use the connector tool to connect the Feature Class output from the iterator, to the Hot

Spot Analysis tool, as the Input Feature Class

Page 12: SpatialStatistics ModelBuilder Tutorial

4. Fill out the Hot Spot Analysis parameters:

a. Double click on the Hot Spot Analysis tool. For the Input Field, choose HD_Rate.

b. For the Output Feature Class, navigate to the HotSpots Feature Dataset in your

Geodatabase. To give each resulting Hot Spot feature class a unique name, you are

going to use an INLINE VARIABLE again, this time using the Name variable from the

feature class iterator. The Name variable holds the name of the feature class that is

currently being used in the analysis. Your Output Feature Class will look something like

this: …\HeartDisease\CDCWonderAnalysis.gdb\HotSpots\%Name%_HotSpots

c. For the Conceptualization of Spatial Relationships parameter, choose

GET_SPATIAL_WEIGHTS_FROM_FILE

d. At the bottom, for the Weights Matrix File parameter, navigate to the location where

you saved the Spatial Weights Matrix in the preparatory steps, and hit OK

5. So that the hot spot maps will be added to the Table of Contents, right click on the feature class

output from the Hot Spot Analysis tool, and choose Add to Display

6. Validate Entire Model

7. Save your model. Navigate to your CDCWonderAnalysis Toolbox, name the tool

YearlyHotSpot.

8. Run Entire Model

Page 13: SpatialStatistics ModelBuilder Tutorial

Note: Ignore messages about problems reading records. Since we have counties for the entire United

States, but records for only the Southern states, some of the records have null values. Counties with

null values for HD_Rate will not be included in the analysis. Also: if the hot spot maps are not

automatically added to the Table of Contents, make sure the Add to Display and Model Parameter

options for the %Name%_HotSpots element are check ON, then re-run the model.

Animate your Hot Spot Results

1. You should now have 8 feature classes that were added to your display…a hot spot analysis for

each year in the dataset. Switch your view in the Table of Contents (TOC) to the “List by

Drawing Order” option.

2. If your Hot Spot Analysis results are not in order, put them in order with 1999 at the bottom,

and 2006 at the top. Uncheck each layer to turn off drawing.

3. Select all of the hot spot layers in the TOC by holding down the Ctrl key and clicking each one

4. With them selected, right click on any of the selected feature classes (anywhere in the blue

selection), and choose the “Group” option. A new Group Layer will be created, with all of your

hot spot analysis results inside. Name your new group: Hot Spot Analysis Results.

5. In the grey space in the top of the application, where all of the toolbars are, right click and

choose the “Animation” toolbar from the list of toolbars.

6. From the Animation toolbar drop-down, choose to “Create Group Animation”

a. For the “Select a group layer” parameter, choose your Hot Spot Analysis Results group

layer that you just created

b. For the “Layer Visibility” set of options, leave the One Layer at a time option checked,

but also check the Invert Order option (this will turn them on from the bottom to the

top, and since your hot spot analysis results go from 1999 at the bottom to 2006 at the

top, you will want to invert the order)

c. Accept all other defaults, and hit OK

Page 14: SpatialStatistics ModelBuilder Tutorial

7. From the Animation toolbar, open the Animation Controls

a. From the options, choose to make the animation 20 secs.

b. Press play to watch the animation of your hot spot analysis results over time

c. You can also play around with the options to slow down or speed up the animation, as

well as some other parameters


Recommended