Exercise 8


Published on

Published in: Technology
  • Be the first to comment

  • Be the first to like this

No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Exercise 8

  1. 1. Making a Spatial Query, Merging, and Joining Data. GIS in Planning and Health
  2. 2. <ul><li>Go to Google.com and type “Acute Care Hospital New Jersey Shapefile” </li></ul><ul><li>You should be able to find a link which shows the following </li></ul><ul><ul><li>www.state.nj.us/health/chs/gis/nj_ hospital s.htm </li></ul></ul><ul><li>After you click the link, you should be able to find the link </li></ul><ul><ul><ul><ul><li>http://www.state.nj.us/health/chs/gis/nj_hospitals.zip </li></ul></ul></ul></ul><ul><li>click and extract the file to c:gis directory </li></ul><ul><ul><li>The new shape file has a name, “nj_hospitals.shp” </li></ul></ul><ul><ul><li>You may notice that the file contains *.prj file. </li></ul></ul><ul><li>Download “Counties of New Jersey”-stco.zip file from </li></ul><ul><ul><li>http://www.state.nj.us/dep/gis directory </li></ul></ul><ul><ul><li>There is no *.prj file for stco.shp file. We need to define a projection </li></ul></ul><ul><li>Run ArcMap and add stco.shp (after you define a projection) and nj_hospitals </li></ul>
  3. 3. <ul><li>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. </li></ul><ul><ul><li>We can select RWJ-New Brunswick from the attribute table of nj_hospitals.shp. </li></ul></ul><ul><ul><li>To open the attribute table, right-click nj_hospitals. And click “Open Attribute Table”. </li></ul></ul>
  4. 4. <ul><li>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. </li></ul><ul><ul><li>To do this, you can left-click on the “HNAME” variable and highlight it. </li></ul></ul><ul><ul><li>Right-click your mouse on the variable, to see the short cut key box. </li></ul></ul><ul><ul><li>Choose “Sort Ascending” button. </li></ul></ul>
  5. 5. <ul><li>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) </li></ul><ul><ul><li>To select the hospital, you need to select the corresponding small box on the left side </li></ul></ul><ul><ul><li>(then it will select entire row). </li></ul></ul><ul><ul><li>When you select cases, you can see on the map the RWJ hospital is highlighted with a big blue dot. </li></ul></ul><ul><li>Next, we will export the selected point in order to create a new shape file with RWJ hospital-New Brunswick only. </li></ul>
  6. 6. <ul><li>To create another shape file based on your selection, you can right-click on the layer to see the menu. </li></ul><ul><ul><li>Select “Data” </li></ul></ul><ul><ul><li>Select “Export Data” </li></ul></ul><ul><li>In Export: choose “Selected features” since we are only interested in exporting the selected hospital. </li></ul><ul><li>Use the existing coordinate system: we choose “this layer’s source data” </li></ul><ul><ul><li>In fact, you can choose “the data frame”, too. It will create “prj” file for the newly created shape file. </li></ul></ul><ul><li>Output shape file name: Name the new shapefile anything you feel appropriate that you will be able to remember in the future. </li></ul><ul><li>When the application ask “Do you want to add….?” click “Yes’ </li></ul>
  7. 7. <ul><li>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. </li></ul><ul><ul><li>Click Toolbox button, and choose “Proximity” followed by “Buffer”, you can now see the “Buffer Window” box. </li></ul></ul><ul><li>Input Features : the layer that you want to buffer </li></ul><ul><li>Out feature : what you want to name the resulting buffer </li></ul><ul><li>Distance : make sure we choose “Miles” as a unit for this analysis, and set “5”. </li></ul><ul><li>**Alternately: you can choose “Field” which means that you buffer based on the field value instead of the fixed value.** </li></ul><ul><li>The 5-mile buffered area covers Middlesex and Somerset counties. We can now download census tract boundary (2000) from geographynetwork.com for these counties. </li></ul>
  8. 8. <ul><li>We need to download census tract (2000) layers from www.geographynetwork.com site. </li></ul><ul><ul><li>Download Middlesex and Somerset counties. </li></ul></ul><ul><ul><li>Once you download you need to “define projection” for those shape files, since they don’t have prj files. </li></ul></ul>
  9. 9. 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.
  10. 10. <ul><li>To apply the “Merge” function: </li></ul><ul><li>Click ArcToolbox </li></ul><ul><li>Choose: </li></ul><ul><ul><li>“ Data management Tools” </li></ul></ul><ul><ul><li>“ General” </li></ul></ul><ul><ul><li>“ Merge”. </li></ul></ul><ul><li>Add the layers that you are going to merge. In this case, the two census tract layers. </li></ul><ul><li>Name your output feature (in this case, MIDSOMCT) </li></ul><ul><li>click OK and then “Close” </li></ul>
  11. 11. 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.
  12. 12. 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.
  13. 13. 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
  14. 14. <ul><li>Click on the Layer you wish to join with your database (in this case, the excel spreadsheet) </li></ul><ul><ul><li>Select “Joins and Relates” </li></ul></ul><ul><ul><li>Choose “Join…” </li></ul></ul><ul><li>Choose the field you will be joining the two together base upon (in this case, STFID) </li></ul><ul><li>Select the name of the spreadsheet you are joining to the layer </li></ul><ul><li>Choose the field within your spreadsheet which correlates to the layer’s field. </li></ul>
  15. 15. This is the outcome of the joined result, we can view demographic data from the attribute of the MIDSOMCT file.
  16. 16. By using joined table result, a thematic map based on HISPANIC variable (quantile method) was created.
  17. 17. <ul><li>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”. </li></ul><ul><li>Create a new field (Add Field). </li></ul><ul><ul><li>Click “Options” button and choose “Add Field”. </li></ul></ul><ul><ul><li>Name: “PHISP” – or whatever you see as fitting </li></ul></ul><ul><li>Type : “Float” (choose this for a number with a decimal) </li></ul><ul><li>Precision : How many columns you want to use for the variable </li></ul><ul><li>Scale : How many columns we want to use as a decimal points </li></ul><ul><li>In this case, we are creating a variable with format “xxxx.xx”, i.e. 9876.87 </li></ul>
  18. 18. <ul><li>We can see that PHISP variable is created without any data. Now we have to calculate the value. </li></ul><ul><li>Choose the variable column (click the variable name) and the entire column will be highlighted. </li></ul><ul><li>Right-click to bring up the menu, </li></ul><ul><ul><li>Choose “Calculate Values” and a new window called “Field Calculator” will pop up </li></ul></ul><ul><li>In the Field Calculator, you can calculate the value of PHISP </li></ul>
  19. 19. This is the newly calculated result. You can create a thematic map to better display the data visually.
  20. 20. <ul><li>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. </li></ul><ul><li>We have to perform “Clip” function (this can be thought of as a “cookie cutting” process.) </li></ul><ul><li>Run ArcToolbox </li></ul><ul><li>Choose: </li></ul><ul><ul><li>“ Analysis Tools” </li></ul></ul><ul><ul><li>” Extract” </li></ul></ul><ul><ul><li>“ Clip” </li></ul></ul><ul><li>Input Features : the shape file which needs to be clipped (the cookie dough) </li></ul><ul><li>Clip features : shape file which will set clip boundary, in this case the 5 mile radius (the cookie cutter) </li></ul><ul><li>Output Feature Class : output name (your resulting cookie) </li></ul><ul><li>Click “OK” </li></ul>
  21. 21. <ul><li>Once you clipped the shape file, you will need to create the thematic map based on PHISP variable again. </li></ul><ul><li>Now we want to identify area which as PHISP more than or equal to 10. </li></ul><ul><ul><li>Choose “Selection” from the menu </li></ul></ul><ul><ul><li>Choose “Select by Attributes” (this allows you to choose an item based on the attribute value) </li></ul></ul><ul><li>From the newly open window, you can create “PHISP” >= 10. </li></ul><ul><li>Click “OK” </li></ul>
  22. 22. 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.
  23. 23. 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.
  24. 24. 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
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.