exercise 8

24
Making a Spatial Query, Merging, and Joining Data. GIS in Planning and Health

Upload: wansoo-im

Post on 27-May-2015

1.128 views

Category:

Technology


2 download

TRANSCRIPT

Page 1: Exercise 8

Making a Spatial Query, Merging, and Joining Data.

GIS in Planning and Health

Page 2: Exercise 8

- Go to Google.com and type “Acute Care Hospital New Jersey Shapefile”- You should be able to find a link which shows the following

- www.state.nj.us/health/chs/gis/nj_hospitals.htm - After you click the link, you should be able to find the link

- http://www.state.nj.us/health/chs/gis/nj_hospitals.zip - click and extract the file to c:\gis directory

- The new shape file has a name, “nj_hospitals.shp”- You may notice that the file contains *.prj file.

- Download “Counties of New Jersey”-stco.zip file from-http://www.state.nj.us/dep/gis directory-There is no *.prj file for stco.shp file. We need to define a projection

- Run ArcMap and add stco.shp (after you define a projection) and nj_hospitals

Page 3: Exercise 8

•After we add county and NJ Hospital shape files, we need to identify which one is RWJ-New Brunswick hospital, so we can identify which counties are within a 5 mile radius.

•We can select RWJ-New Brunswick from the attribute table of nj_hospitals.shp.•To open the attribute table, right-click nj_hospitals. And click “Open Attribute Table”.

Page 4: Exercise 8

Once attribute table is open, we need to find RWJ-New Brunswick hospital. Sort the hospital name variables (HNAME) alphabetically by name to find it easily.

•To do this, you can left-click on the “HNAME” variable and highlight it. •Right-click your mouse on the variable, to see the short cut key box. •Choose “Sort Ascending” button.

Page 5: Exercise 8

You can now scroll down and find “Robert Wood Johnson University Hospital” in Middlesex county (be aware that there are many Robert Wood Johnson Hospitals in New Jersey)

•To select the hospital, you need to select the corresponding small box on the left side(then it will select entire row). •When you select cases, you can see on the map the RWJ hospital is highlighted with a big blue dot.

Next, we will export the selected point in order to create a new shape file with RWJ hospital-New Brunswick only.

Page 6: Exercise 8

To create another shape file based on your selection, you can right-click on the layer to see the menu.

•Select “Data”•Select “Export Data”

In Export: choose “Selected features” since we are only interested in exporting the selected hospital.

Use the existing coordinate system: we choose “this layer’s source data”

•In fact, you can choose “the data frame”, too. It will create “prj” file for the newly created shape file.

Output shape file name: Name the new shapefile anything you feel appropriate that you will be able to remember in the future.

When the application ask “Do you want to add….?” click “Yes’

Page 7: Exercise 8

You can see “RWJ” shape file on the map. Now we have to identify where is 5 mile radius buffer. To do this, we need to use “Buffer” function based on Proximity.

•Click Toolbox button, and choose “Proximity” followed by “Buffer”, you can now see the “Buffer Window” box.

Input Features: the layer that you want to bufferOut feature: what you want to name the resulting bufferDistance: make sure we choose “Miles” as a unit for this analysis, and set “5”.

**Alternately: you can choose “Field” which means that you buffer based on the field value instead of the fixed value.**

The 5-mile buffered area covers Middlesex and Somerset counties. We can now download census tract boundary (2000) from geographynetwork.com for these counties.

Page 8: Exercise 8

We need to download census tract (2000) layers from www.geographynetwork.com site.

•Download Middlesex and Somerset counties.•Once you download you need to “define projection” for those shape files, since they don’t have prj files.

Page 9: Exercise 8

The map view shows both Middlesex and Sommerset Counties as well as the 5 mile buffered area surrounding RWJ, NB.

To be able to do the analysis, we need to combine (merge) two census tract data layers into one.

Page 10: Exercise 8

To apply the “Merge” function:•Click ArcToolbox•Choose:

•“Data management Tools”•“General”•“Merge”.

•Add the layers that you are going to merge. In this case, the two census tract layers.

•Name your output feature (in this case, MIDSOMCT)

•click OK and then “Close”

Page 11: Exercise 8

By merging the two shape files, we created a single shape file which combines both two layers.

We can see the attribute tables, and census tract data from Middlesex (FIPSSTCO = 34023) and Somerset (FIPSSTCO = 34035) counties.

Page 12: Exercise 8

Go to www.geographynetwork.com and download “Census Tract Demographics (SF1)” data – which is based US 2000 Census.

We can see the content of the file by using Excel. The file contains many basic demographic data at the census tract level.

Now we need to download and process population data for the census tract layer.

Page 13: Exercise 8

Once we have downloaded census tract level demographic data, we need to join the file to our merged census tract layer.

By looking at both data files we can tell “STFID” is the key column which can be used for join data because it contains the same Title and information in both datasets

Page 14: Exercise 8

Click on the Layer you wish to join with your database (in this case, the excel spreadsheet)• Select “Joins and Relates”• Choose “Join…”

1. Choose the field you will be joining the two together base upon (in this case, STFID)

2. Select the name of the spreadsheet you are joining to the layer

3. Choose the field within your spreadsheet which correlates to the layer’s field.

Page 15: Exercise 8

This is the outcome of the joined result, we can view demographic data from the attribute of the MIDSOMCT file.

Page 16: Exercise 8

By using joined table result, a thematic map based on HISPANIC variable (quantile method) was created.

Page 17: Exercise 8

Now we have to create Percent Hispanic based on the variables that we have. To calculate Percent Hispanic variable, we need to have “Total Population” and “Hispanic Population”.•Create a new field (Add Field).

•Click “Options” button and choose “Add Field”. •Name: “PHISP” – or whatever you see as fitting

Type: “Float” (choose this for a number with a decimal)Precision: How many columns you want to use for the variableScale: How many columns we want to use as a decimal points

In this case, we are creating a variable with format “xxxx.xx”, i.e. 9876.87

Page 18: Exercise 8

We can see that PHISP variable is created without any data. Now we have to calculate the value. •Choose the variable column (click the variable name) and the entire column will be highlighted. •Right-click to bring up the menu,

•Choose “Calculate Values” and a new window called “Field Calculator” will pop up

In the Field Calculator, you can calculate the value of PHISP

Page 19: Exercise 8

This is the newly calculated result.

You can create a thematic map to better display the data visually.

Page 20: Exercise 8

Since we are interested in a area within 5 miles from the RWJ hospital, we need to identify census tract area only within 5 miles.

We have to perform “Clip” function (this can be thought of as a “cookie cutting” process.)

•Run ArcToolbox• Choose:

•“Analysis Tools”•”Extract” •“Clip”

Input Features: the shape file which needs to be clipped (the cookie dough)Clip features: shape file which will set clip boundary, in this case the 5 mile radius (the cookie cutter)Output Feature Class: output name (your resulting cookie)

Click “OK”

Page 21: Exercise 8

Once you clipped the shape file, you will need to create the thematic map based on PHISP variable again.

Now we want to identify area which as PHISP more than or equal to 10.

•Choose “Selection” from the menu •Choose “Select by Attributes” (this allows you to choose an item based on the attribute value)

From the newly open window, you can create “PHISP” >= 10.

Click “OK”

Page 22: Exercise 8

Now you can see the selected polygon based on the criteria you selected.

Let’s open the attribute table. Those cases highlighted with color are the selected polygons.

By clicking the “Selected” button on the attribute table, we can choose to view only the selected variables.

Page 23: Exercise 8

Now, we want to export the selected cases, and import them into an Excel format to make a decent table.

To export the table result, click “Options” and then click “Export”.

Save the new export however you see fit.

Page 24: Exercise 8

This is the outcome of the selected polygon in excel format.

You can give it a title, neatline and provide additional formatting to make a presentable format.

Deliverables: - Map- Table with Selected Polygons