Grade by Grade
D. Topics in Computer Science · Topics in Computer Science: Sustainability, Emerging Research and Careers

Geographic Information Systems and Human–Computer Interaction

D2.1About 70 minutes
Learning goals
  • I can explain what a geographic information system (GIS) is, including layers, coordinates and spatial queries.
  • I can compute distances between locations and run a simple spatial query in Python.
  • I can explain what human–computer interaction (HCI) studies and apply basic usability and accessibility principles.
  • I can describe current research directions in GIS and HCI.

Words to know

GIS
Geographic information system: software that stores, analyses and displays data tied to locations on Earth.
layer
One set of map data in a GIS, such as roads, rivers or elevation, aligned to the same coordinates as the others.
vector / raster data
Vector data stores points, lines and polygons; raster data stores a grid of cells, each with a value (like pixels).
spatial query
A question about location, such as "which schools are within 2 km of the river?"
human–computer interaction (HCI)
The study and design of how people use computers, aiming for systems that are useful, usable and accessible.
usability
How easily and effectively people can use a system to reach their goals.
accessibility
Designing so that people with disabilities can use a system, for example with screen readers, captions or keyboard-only navigation.

Two kinds of maps

When you call 911, the dispatcher's screen shows where you are and which ambulance is closest. When a forest fire starts in northern Ontario, crews see maps of the fire, the wind, the roads and the communities nearby. Both use a geographic information system (GIS).

And every one of those systems is useless if the people under pressure can't figure out the screen. Designing screens that people can use quickly and correctly is the job of human–computer interaction (HCI). Both are research areas named in the curriculum.

What is a GIS?

A GIS stores data together with where it is, usually as latitude and longitude. Each kind of data is a layer:

  • Vector layers store points (schools, fire hydrants), lines (roads, rivers) and polygons (lakes, parks, property lines).
  • Raster layers store a grid of values, like an image: elevation, temperature, or satellite photos.

Because all layers use the same coordinates, a GIS can answer spatial queries that combine them: Which homes are in the flood zone? Which areas are more than 30 minutes from a hospital? Where are the snowplough routes that pass the most schools?

Schools and hospitals (points)Roads (lines)Rivers and lakes (lines and areas)Elevation (raster grid)Layers are stacked on the same coordinates and can be queried together.
A geographic information system (GIS) stores each kind of data as a layer tied to real locations. Because the layers line up, you can ask questions that combine them.

Where GIS is used

  • Emergency services: locating callers, routing ambulances and fire trucks.
  • Natural resources: forest inventories, wildfire management, wildlife habitat (connecting to the lesson Computers That Save Resources).
  • City planning: where to put new schools, transit lines and bike lanes.
  • Public health: mapping where illnesses occur to find causes.
  • Indigenous land and resource planning: many First Nations, Métis and Inuit communities use GIS to map traditional land use, place names, harvesting areas and important sites, often based on interviews with Elders and knowledge holders, and use those maps in planning and in negotiations about land and resources.

Research in GIS includes handling huge streams of satellite and sensor data, real-time mapping (for example during floods), 3D city models, and protecting privacy when location data is about people.

Computing with locations

The Earth is (nearly) a sphere, so the distance between two latitude/longitude points is not given by the flat distance formula. GIS software uses formulas such as the haversine formula:

import math
def distance_km(lat1, lon1, lat2, lon2):
R = 6371 # Earth's mean radius in km
p1, p2 = math.radians(lat1), math.radians(lat2)
dp = p2 - p1
dl = math.radians(lon2 - lon1)
a = math.sin(dp / 2) ** 2 + math.cos(p1) * math.cos(p2) * math.sin(dl / 2) ** 2
return 2 * R * math.asin(math.sqrt(a))
print("Toronto to Ottawa:", round(distance_km(43.65, -79.38, 45.42, -75.70)), "km")
print("Toronto to Vancouver:", round(distance_km(43.65, -79.38, 49.28, -123.12)), "km")

The haversine formula gives the straight-line (great-circle) distance between two latitude/longitude points. Road distances are longer. Output (one line each): Toronto to Ottawa: 352 km / Toronto to Vancouver: 3359 km

For a small area such as a town, a flat grid measured in kilometres is close enough, and the distance formula from math class works. Here is a spatial query:

import math
places = [("Library", 1.0, 2.0), ("Arena", 3.5, 0.5), ("Clinic", 0.5, 4.0),
("School", 2.0, 1.5), ("Fire hall", 5.0, 4.0)]
home_x, home_y = 1.5, 1.0 # km on the town grid
for name, x, y in places:
d = math.sqrt((x - home_x) ** 2 + (y - home_y) ** 2)
if d <= 2:
print(name + ":", format(d, ".2f"), "km")

A spatial query: which places are within 2 km of home? (Town coordinates are invented.) Output (one line each): Library: 1.12 km / School: 0.71 km

Worked example

Example 1: A spatial query by hand

Using the town grid in the program, which places are within 3 km of home at (1.5, 1.0)?

  1. Library (1.0, 2.0): √(0.5² + 1²) = √1.25 ≈ 1.12 km. Yes.
  2. Arena (3.5, 0.5): √(2² + 0.5²) = √4.25 ≈ 2.06 km. Yes.
  3. Clinic (0.5, 4.0): √(1² + 3²) = √10 ≈ 3.16 km. No.
  4. School (2.0, 1.5): √(0.5² + 0.5²) = √0.5 ≈ 0.71 km. Yes.
  5. Fire hall (5.0, 4.0): √(3.5² + 3²) = √21.25 ≈ 4.61 km. No.

Within 3 km: Library, Arena and School.

Human–computer interaction

HCI studies how people use computers and how to design systems that are useful, usable and accessible. HCI researchers watch real people use software, measure how long tasks take and how many errors they make, and test new kinds of interfaces.

Some basic usability principles (you apply these when you design user-friendly interfaces in the unit Software Development):

  1. Visibility: users can see what they can do and what state the system is in.
  2. Feedback: every action gets a clear response (a button changes, a message appears).
  3. Consistency: similar things look and work the same way everywhere.
  4. Error prevention and recovery: design so mistakes are hard to make, and when they happen, explain clearly how to fix them without losing work.
  5. Accessibility: support screen readers, captions, keyboard-only use, enough colour contrast, and never use colour alone to give information. In Ontario, the Accessibility for Ontarians with Disabilities Act, 2005 (AODA) includes standards for accessible websites.
Hard to useEasier to useM5V3L9ERROR 0x3F: INVALID INPUT(no hint about what is wrongor how to fix it)Postal codeM5V3L9Add a space: postal codes looklike A1A 1A1 (e.g. K1A 0B1).The field keeps what you typed.
Two ways to report the same mistake. Good interfaces give a label, a specific, polite message that says how to fix the problem, and keep the user's work.

HCI research frontiers

  • Voice and conversational interfaces, such as voice assistants and chatbots.
  • Virtual and augmented reality, where the interface surrounds you.
  • Eye tracking and gesture control, which can help people who cannot use a mouse or keyboard.
  • Brain–computer interfaces, an early research area that reads brain signals to control devices.
  • Designing for everyone: older adults, young children, people with disabilities, and people using different languages.
Just for fun

A usability tester's favourite question: "Where would you click to cancel?"

The most common honest answer in early prototypes: "I'd close the laptop and go outside." That is why testers watch real people instead of guessing.

Hands-on activity

Usability test at home

You need: a family member or friend, a phone or computer, a timer, and paper.

  1. Pick a task on a real website or app your tester has not used before, for example "find this weekend's hours for the public library" or "find how to recycle batteries on our town's website".
  2. Ask the tester to think aloud while they try. Do not help. Time the task and write down every place they hesitate or make a mistake.
  3. Repeat with a second task.
  4. For each problem you observed, name the usability principle it breaks (visibility, feedback, consistency, error prevention, accessibility) and suggest a fix.
  5. Bonus: try the same task using only the keyboard (Tab, Enter, arrow keys). Could you do it?

What to look for: specific observations ("spent 40 s looking for the Hours link, which was hidden in a menu called Info"), each matched to a principle, with a realistic fix.

Your turn

1

What does GIS stand for, and what makes GIS data different from an ordinary spreadsheet?

2

Classify as vector or raster: (a) bus stops, (b) a satellite photo, (c) a lake outline.

3

Write a spatial query a city might ask before choosing a site for a new library.

4

On a flat town grid, how far is (0, 0) from (3, 4) in km?

5

What does HCI study?

6

Name three usability principles.

7

Why should a website never use colour alone to show an error?

More practice: warm-up

1

What is a layer in a GIS?

2

Give one use of GIS in emergency services.

3

What is accessibility?

4

What Ontario law includes standards for accessible websites?

5

What is feedback in an interface?

More practice: on your own

1

Change the spatial query program to find places within 1 km of home. What does it print?

2

Why can't you use the flat distance formula with latitude and longitude for Toronto to Vancouver?

3

A form clears every field when the user makes one mistake. Which principle does this break, and how would you fix it?

4

Explain how a GIS could help plan snowplough routes.

5

Describe one way a First Nation might use GIS in land and resource planning.

Challenge

1

Use the haversine program to find the straight-line distance from Ottawa (45.42, −75.70) to Québec City (46.81, −71.21), to the nearest km.

2

Fitts's law, from HCI research, predicts the time to point at a target: T = a + b·log₂(1 + D/W), where D is the distance to the target and W its width. With a = 0.1 s and b = 0.15 s, compare a 16-pixel-wide button with a 64-pixel-wide button, both 256 pixels away. What design lesson follows?

3

Write a Python function nearest(places, x, y) that returns the name of the place closest to (x, y). What does it return for home (1.5, 1.0)?

Check your understanding

Quiz

1.

Which is raster data?

2.

What is a spatial query?

3.

On a flat town grid, what is the distance from (1, 1) to (4, 5) in km?

4.

Which error message follows good usability principles?

5.

Which design choice improves accessibility?

6.

According to Fitts's law, which button is fastest to click?

For parents and teachers

Big idea: Expectation D2.1 names geographic information systems and human–computer interaction as emerging research areas. Students learn how GIS layers and spatial queries work, compute distances in Python, and apply usability and accessibility principles.

How to help: Be the tester in the usability activity, and think aloud honestly. Look at a map app together and identify layers (roads, transit, businesses, traffic). Ask which apps your family finds frustrating, and why.

Common difficulties:

  • Confusing vector (points, lines, polygons) with raster (grid) data.
  • Using the flat distance formula on latitude and longitude for long distances.
  • Thinking accessibility only helps a few people. Captions, clear messages and keyboard shortcuts help everyone.