← Introduction to GIS Software: QGIS

In-class Excercises

Part 1: Adding columns to an attribute table

  1. Download and open the city council districts shapefile via Bytes of the Big Apple.
  2. Enter edit mode for the layer by going to Layer > Toggle Editing.
  3. Open the Field Calculator.
  4. Create a new field with name area_sqft, type Decimal number (real), length 15, and precision 2. Use the expression $area to calculate the area.
  5. Confirm that the field was added to the attribute table.
  6. Do this again, but this time call the field area_sqmi and use the expression $area / (5280 * 5280) to calculate the area in square miles.
  7. Exit edit mode.

Part 2: Counting points in polygons in QGIS

  1. Re-open the city council districts from the previous part if you closed it.
  2. Find the count of points in by city council district: go to Vector > Analysis Tools > Points in Polygon and ensure that the city council districts are selected for the polygon layer, Airbnb data for the points layer.
  3. Open the attribute table for the new shapefile. It should have a new column named PNTCNT. Is it NULL for every feature? Why might this be, and how can you fix it?
  4. Fix the problem and leave the file open for the next part.

Part 3: Styling choropleths in QGIS

  1. Using the data from the previous part, style it using a Graduated style with the new PNTCNT column.
  2. Try a few classification schemes and look at the histogram for each.

Part 4: Normalizing data in QGIS

  1. Using the data from the previous part, style it using a Graduated style with the new PNTCNT column normalized to the area of the city council districts.
  2. To do this, create a new column using the Field Calculator and divide the count by the area in square miles. Use this new column to make a graduated style.
  3. Again, try a few classification schemes and look at the histogram for each.

Part 5: Style using expressions

  1. Download and open the AirBnB listing data for NYC via Inside AirBnB.
  2. Style the size of the markers based on the price attribute, dividing by a 100. Your expression should look like "price" / 100.
  3. There are some very large prices we would like to hide for this map. Filter the layer to only show features where price is less than 2000.