From 400 phones to one place

Many trajectories, one day, and what a place can learn from them · GGR444
Step 1

One day of location data for a city

Four hundred people carried a phone for one day. One fix per minute each. This is what the raw data looks like on a map.

Every person's track for the whole day, one line each. Scroll to zoom, drag to pan.

The data

people
GPS fixes
24 hone day

Three columns per row: person_id, time, x, y. No names, no addresses, no purpose of travel.

This is what a mobility data vendor starts from. The dense smudges are places where many people stood still. The lines between them are trips. Everything else has to be derived.

Step 2

One person: break the day into stays and trips

Take one of the 400. The stay-point rule from the trajectory lecture, all fixes within m for at least min, splits the day into stays and the trips between them.

One person's track, with detected stays numbered in order. Stays at the same location share one circle (1, 4 and 6 are all home). Circle size is total dwell time.
The same day as a timeline: stays in violet, trips in orange.

This person's day

stays
trips

Six columns of numbers became a list of episodes. Every step from here on works on stays, not on fixes.

Step 3

Everyone: stays, in order

Run the same rule on all 400 people. Sort each person's stays by time and the day becomes a sequence: where they were first, second, third.

All detected stays (grey: at the 03:00 location, taken as home; violet: elsewhere). Four of the 24 sampled people are drawn as paths: stays numbered in order, arrows pointing forward in time. Their rows on the right use the same colours.
24 people as rows: each bar is a stay, numbered in order; gaps are trips. The four coloured rows are the people drawn on the map. Hover a bar.
stays
trips
stays per person
median dwell away from home

Home is not in the data either. It is inferred: the place where each person was at 03:00. Work, in a multi-day dataset, is inferred the same way from weekday daytime hours. With one day we stop at home.

Step 4

Join the stays to places

Add the points of interest and the census tracts. A stay within m of a point of interest takes its name and category. The sequences turn into activities.

Stays that matched a point of interest, one bubble per place sized by the number of stays. Dark grey: stays at residential addresses with no point of interest. Light grey: home.
The same 24 people, now with a category for every stay.
The whole city's day: how many people are in a stay of each category, hour by hour.
Step 5

Flip it around: look at one place

Until now the unit was a person. Now the unit is a place. Every stay that matched it is a visit. Choose a place:

Arrivals by hour
How long visitors stay

visits
distinct visitors
median dwell

Visits, unique visitors, arrival curve, dwell time. This is the first page of a commercial foot-traffic report, and it came out of the stays table with one filter.

Try the University, the General hospital and Grocery West after the mall. Same pipeline, very different curves.

Step 6

Who visits: home tracts and the census

Each visitor has an inferred home. Each home falls in a census tract. Each tract has a published profile. Count visitors by home tract, weight the tract profiles by those counts, and you have a demographic profile of the place's visitors.

Where visitors live
Share of visitors by home tract. Hover a tract for its census profile.
Visitor profile vs the city
median household income, visitors' tracts
city average

This is exactly how vendors report "visitor demographics": not from the people, from the census geography of their inferred homes. It is an ecological inference. It is also the only way to do it without collecting personal data.

Step 7

Where they came from, where they went next

Because stays are ordered, every visit has a previous stay and a next stay. Count them by category and the place sits in the middle of the city's day.

Left: the category of the stay before the visit. Right: the stay after. Width is the number of visits.

Top places before and after

A mall that knows most visitors come straight from work and go straight home markets differently from one whose visitors come from the park and go to dinner. The same table answers "who else shares my customers".