← Methods 3

In-class Exercises

Part 1: Modeling

In this part we will use the data we worked with in the previous part to make a simple model. We will attempt to make a model that can predict where there will be more pressure on renters due to Airbnb listings in their neighborhoods.

  1. Download today's data.
  2. In QGIS, open the shapefile in queens_airbnb_model.
  3. Using the field calculator, create two new fields. The new fields should scale each field using scale_linear.
    1. First, med_income has a minimum value of 15474, maximum value of 151964, so we use this expression in the field calculator:
      scale_linear("med_income", 
          15474, 151964,
          1, 0)
      Add an s_ at the beginning of the new field name to indicate that it is scaled. In this case, med_income becomes s_income (since you can only use 10 characters in a name). s_income should be a decimal number field with length 10 and precision 8.
    2. Follow a similar process for n_airbnb (created when we calculated the Airbnb listings per tract):
      scale_linear("n_airbnb", 
          minimum points, maximum points,
          0, 1)
      You'll need to find the minimum and maximum values for n_airbnb. Make the resulting field s_airbnb, also a decimal number with length 10 and precision 8.
  4. Create a graduated style for the tracts. For the column expression, add each of the scaled fields (s_airbnb, s_renters, s_income) together.

Part 2: Changing properties with CartoCSS

  1. Upload the VNP14IMGTDL_NRT_Global_24h shapefile from today's data to Carto. You can just use the zip file without unzipping it. These are fires detected over a 24 hour period, retrieved Oct 11, 2019 from FIRMS.
  2. Open the CartoCSS documentation.
  3. Make a map with the data and style the points.
  4. Using CartoCSS:
    1. Make the markers 5 pixels wide.
    2. Give the markers an outline 2 pixels wide.
    3. Give the fill and stroke of the markers different colors.

Part 3: CartoCSS Zoom Conditions

  1. Make your markers 5 pixels wide below zoom level 8.
  2. Make your markers 15 pixels wide above or at zoom level 8.

Part 4: CartoCSS Attribute Conditions

  1. Make your markers a different color when the daynight is D.