5 - Tabular Join and Shapefile Creation

Tabular Join

The covid_selected_CLN data does not currently have a shape that can be presented on a map. How can we turn this dataset to a shape so we can draw a map? Join this dataset to the census boundary shapefile! When we join datasets using tabular data (e.g. csv file), we perform tabular join.

  1. census_county -> Properties -> Joins
    • Join layer: covid_selected_CLN
    • Join filed: GEOID
    • Target field: GEOID
    • Custom filed name prefix: covid_
  2. Check Attribute table

Export as a Shapefile

Now you have your COVID-19 data joined to the census county shapefile. However, this data you just created is not saved, meaning once you close QGIS (or when it crashes), you will lose it. To make our life easy, let’s create a shapefile of this data!

  1. census_county -> Export -> Save Vector Layer as
    • Format: ESRI Shapefile
    • Filename: covid_county
      • Make sure to specify the location to save the file
      • For this demo, save it under "ASA_GIS" -> "data" -> "vector"
      • CRS: EPSG 4269
  2. Remove join
    • Properties -> Joins -> Click "-" sign

Let's join the mask wearing survey data to the covid_county shapefile!

  1. covid_county -> Properties -> Joins
    • Join layer: mask-use-by-county.csv
    • Join filed: GEOID
    • Target field: GEOID
    • Custom filed name prefix: mask_
  2. Check Attribute table

Percentage calculation using Field Calculator

The mask wearing data has the proportion of people who wear masks in decimal points, and we want to map the data "Always" (% of people who answered that they always wear masks) in percentages. We can use Field Calculator to perform such calculation.

  1. covid_county -> Attribute Table -> Field Calculator
    • Output field name: always_per
    • Output field type: Decimal number (real)
    • Expression
      • Under Fields and Values, select mask_ALWAY
      • Write this expression: (mask_ALWAY)*100
  2. covid_county -> Export -> Save Vector Layer as
    • Format: ESRI Shapefile
    • Filename: mask_covid_county
      • Make sure to specify the location to save the file
      • For this demo, save it under "ASA_GIS" -> "data" -> "vector"
      • CRS: EPSG 4269
  3. Remove join
    • covid_county -> Properties -> Joins -> Click "-" sign