In-class Excercises
Part 1: Mapping SAT results
- Download today's data.
- Join the spreadsheet (
SAT_Results.csv
) to the shapefile (Public_School_Locations
). - Use Select by expression to select the features that successfully joined with the spreadsheet and save that selection to a new shapefile. You will want to select all features where one of the fields that was joined from the spreadsheet
IS NOT NULL
. - Use the Field Calculator to replace all
s
values in the columns that should be numeric withNULL
. - Create a new column for each column that should be numeric, converting the value in the original column from text to an integer.
- Now that we have numeric columns, use them to style the schools using graduated styles.
Part 2: Spatial Joins, points to polygons
Here we add data to NYC's school districts based on the SAT results of the schools that fall within them.
- Use the joined layer we created in the last part.
- Download the shapefile for NYC School Districts.
- Join by location by going to Vector > Data Management Tools > Join Attributes By Location:
- Make the school districts the Target vector layer.
- Make the schools with SAT scores the Join vector layer.
- Under Attribute Summary, select Take summary of intersecting features and leave Mean selected.
- Select a place to save the results and click OK.
- Examine the resulting shapefile's attribute table.
- Style the data using a graduated style.
Part 3: Spatial Join, polygons to points
This time we will add data to the schools by which school district each falls into.
- Clear the layers from the previous part or create a new project.
- Open the shapefile
Public_School_Locations
and the original school districts shapefile that you downloaded in the previous part. - Join by location by going to Vector > Data Management Tools > Join Attributes By Location:
- This time make the schools the Target vector layer.
- And this time make the school districts the Join vector layer.
- Under Attribute Summary, select Take attributes of the first located feature.
- Select a place to save the results and click OK.
- Examine the resulting shapefile's attribute table.
- Style the resulting shapefile. For example, use a categorized style on school district number.