Mapping Homelessness in San Diego

Mapping homelessness in San Diego

  • Recall Day 1 we downloaded the data for homelessness in San Diego. Now we can map it.
  • We are going to merge the count of homeless persons by block group that we created for Day 1. See San Diego Regional Data Library data example to refresh your memory on how we did this.
  • Download the shapefile for San Diego blocks for the year 2010 (why 2010 versus 2020?). You can download that at TIGER/Line Shapefiles (census.gov) Unzip the files to your hard drive. You will see multiple files in the folder you just unzipped. We will review them now.
  • Open QGIS. From the file menu select Layer --> Add Layer --> add Vector Layer as shown below.
    Pasted image 20230805125124.png
  • Browse to the folder you just downloaded and select tl_2010_06073_tabblock10.shp. You can also open the file from the folder ex/homeless data that has been provided to you
  • You should see something that looks like the image below. The shape of the map is San Diego county and the boundaries contained therein represent census blocks in the county.
    Pasted image 20230805133517.png
  • Recall in Day 2 we learned that in order to merge files there needs to be a unique key. We also learned during Day 1 that Excel formulas are handy for data wrangling. We need to create a one-to-one correspondence between our census block groups and our homeless counts.
  • Take a look at the two datasets. It is clear that the field linking the two is geoid. Unfortunately, we need to remove the first 7 characters from our data file before the merge will be successful. See Understanding Geographic Identifiers (GEOIDs) (census.gov) for an in-depth explanation of the geographic identifiers contained in Census data.
  • We will create a new variable called GEOID10 (why?) that has the unique census block ID for each census block in the downtown area

❓ Your turn

  • Open the file count_by_blk.xlsx
  • Click on the tab GEOID10
  • Column C has the following formula >=right(A2, 15)<
  • Compare this column with the GEOID10 column in the shapefile you have open in QGIS. They now match.
  • I created a separate file called GEOID10_counts_to_merge.csv.
  • Open this file in QGIS (Layer --> Add Layer --> Add delimited). Make sure you choose 'Text (string)' for the GEOID column as I show in the figure below and that 'No geometry (attribute only table)' is selected or this will FAIL.
  • Let's merge the two files and make the map shown on the webpage.

Pasted image 20230805131229.png

  • Now the data are merged and can be mapped!
    Pasted image 20230805132350.png
  • Compare the map below to the one on the website. They look identical!
    Pasted image 20230805133038.png

Even Better

  • Let's incorporate more data into the map
  • Download the landmark dataset
  • Clip the landmark dataset to the downtown area
  • Add OpenStreetMap data
  • Make a heatmap
    Pasted image 20230805170558.png
  • Make some observations
    Pasted image 20230805171345.png