ENCN205 · GIS Component · Lab 2

Lab 2: Vector Analysis — Infrastructure Exposure Assessment

University of Canterbury · Te Whare Wānanga o Waitaha

Duration: 2–3 hours  ·  Format: Python (Jupyter notebook)  ·  Prerequisite: Lab 1  ·  Assessment: sign-off quiz submitted to LEARN

1Learning Objectives

2Engineering Scenario

You are a graduate engineer at a consulting firm assessing coastal infrastructure exposure for the Christchurch City Council. Your task is to determine which buildings, roads, and communities are at risk from sea-level rise in the 0–5 m elevation zone. You will combine census, infrastructure, and hazard data to produce an exposure report.

Start as usual: conda activate encn205, then jupyter lab, then open Lab2_VectorAnalysis.ipynb and run the cells in order with Shift + Enter.

3Step-by-Step Instructions

Section 1: Setup and Data Creation

Load libraries and the Christchurch coastal zone datasets — buildings, pipes, statistical areas, and a coastal hazard zone.

Section 2: Attribute Queries

Filter GeoDataFrames by attribute values. Identify residential buildings in the low-elevation zone. Practice combining multiple filter conditions with & and | operators.

Section 3: Table Joins (.merge())

Merge a valuation table (plain DataFrame) to buildings (GeoDataFrame) using a shared key. Verify the result retains geometry. Map buildings by capital value.

Section 4: Spatial Joins (gpd.sjoin())

Assign each building to its statistical area using a spatial join. Summarise building counts and values per area. Practice spatial join with pipe data.

Section 5: Buffer Analysis

Create 50 m buffer zones around pipes. Use a spatial join to find buildings within buffer zones. Understand how buffer distance depends on CRS units.

Section 6: Clipping

Extract buildings within a focus area boundary using gpd.clip(). Compare the full dataset to the clipped result.

Section 7: Dissolve and Aggregation

Merge statistical areas by deprivation category. Aggregate population and other attributes. Compare individual vs dissolved maps.

Section 8: Interactive Maps

Create interactive web maps with .explore(). Add multiple layers, tooltips, and popups. Experiment with different basemap tiles.

Section 9: Exposure Assessment

Combine all techniques: filter at-risk buildings, spatial join to areas, summarise by deprivation level. Produce a final exposure map and summary table.

4Assessment: Lab Sign-Off

This lab is not complete until you have submitted your sign-off to LEARN.

Step 1 — Self-check

Before you start the quiz, make sure you can do each of these:

Step 2 — Take the sign-off quiz

  1. Download Lab2_SignOff.html from LEARN and open it in your web browser.
  2. Enter your full name and University ID, then answer the 10 questions.
  3. You need 8 out of 10 to pass. You can retake it as often as you like — each attempt draws a new set of questions, and every answer comes with an explanation.
  4. When you pass, click Download Sign-Off PNG. This saves a file called ENCN205_Lab2_<yourID>.png.

Step 3 — Submit

Upload ENCN205_Lab2_<yourID>.png to the Lab 2 Sign-Off submission on LEARN.

The PNG records your name, ID, score, and a timestamp inside the QR code. It's your proof of completion — show it to your tutor if they ask.

Tips and Troubleshooting

SymptomFix
Spatial join returns empty Check both layers have the same CRS
.explore() fails conda install -c conda-forge folium mapclassify
Buffer distances look wrong Always buffer in a projected CRS (EPSG:2193), never geographic (EPSG:4326)
dissolve fails Check for None/NaN values in the grouping column
Unsure what an operation returned Use type(result) to verify you still have a GeoDataFrame