← Methods 3

In-class Exercises

Part 1: Attribute Joins

  1. Download this class's data.
  2. Open the (unbuffered) file Public_School_locations in QGIS.
  3. Open the CSV in school-demographic-snapshot in QGIS using the Add Delimited Text Layer tool, and select No geometry under Geometry Definition.
  4. Attribute join the demographic snapshot to the public schools. Use DBN from the demographic snapshot, ATS_CODE from the Public_School_locations.
  5. Style the schools using the joined data. Consider creating a graduated style based on one of the numeric columns.
  6. Save the joined layer for later (part 3).

Part 2: Join census data

  1. In Excel, open the data (ACS_17_5YR_B25003/ACS_17_5YR_B25003_with_ann.csv).
  2. Prepare your data:
    1. Rename HD01_VD01 to total_households.
    2. Rename HD01_VD02 to total_owners.
    3. Rename HD01_VD03 to total_renters.
    4. Delete row 2, which should contain Id, Id2, Geography, etc.
    5. Delete all columns that do not have headers that start with GEO and that we did not rename.
    6. Save the data as an Excel spreadsheet (.xlsx).
    If it helps, this week's data contains an edited version of this CSV (in ACS_17_5YR_B25003/ACS_17_5YR_B25003_edit.xlsx).
  3. Open your the edited spreadsheet in QGIS by dragging and dropping it.
  4. Open the shapefile in nys_census_tracts QGIS.
  5. Join the spreadsheet to the shapefile. You should be able to use GEO.id and GEO_ID.
  6. What if we only wanted to see this map for NYC? Save the joined layer as a new shapefile, then clip that layer to the Borough Boundaries shapefile. That is, remove the tracts and parts of tracts that are outside of the borough boundaries. Style this layer with a graduated style.

Part 3: Spatial Joins

  1. Open the saved file from part 1 (schools joined with demographics).
  2. Open the shapefile in school-districts.
  3. Use Join Attributes by Location (Summary) from the search bar to find the average (mean) Total Enrollment by school district.
  4. Style the school districts by the average enrollment.