Demographics
Copy link

Get data on the people who live in an area, including population, households, age, renting, car ownership and income. You can get it for each H3 cell, for each boundary, or as a total over a catchment.

This page answers questions such as:

  • How many people live within 30 minutes?
  • How many people in my catchment have no car?
  • What share of households have no car?

Each JSON response names its data sources once, in sources. Where a value draws on more than one source, it is a list. The sources are:

  • population: WorldPop's 2020 grid (worldpop_2020)
  • census: the national census. In the United Kingdom, this is the 2021 Census for England and Wales (ons_census_2021_ew), Scotland's 2022 census (nrs_census_2022) or Northern Ireland's 2021 census (nisra_census_2021), plus ONS small-area income for the financial year ending 2020 (ons_income_fye2020_msoa) where income is present

The updated_at field in /v1/catalog/{country} gives the date the data was last loaded.

Request headers
Copy link

Required authentication header. Use the same application id as for the TravelTime API.

string

Required authentication header.

Demographics per H3 cell, per boundary or in total
Copy link

GET /v1/demographics/cells

Returns the population (from WorldPop) and a census block for each H3 cell. You can also get totals over the area you send. With a boundary type, such as group_by=borough, you get one row per boundary, and with group_by=all you get one row for everything. Only resolution 9 is supported, but a group_by=all total also accepts coarser cell ids. For long lists of cells, use POST /v1/demographics/cells, which takes the same fields in a JSON body (see Long requests).

Parameters
Copy link

ParameterTypeDefaultWhat it doesExample
min_populationinteger—Returns only H3 cells with at least this many people.min_population=100

The endpoint also takes the following common parameters:

Each row contains:

  • cell, the H3 cell. A total has cell_count instead, plus boundary with group_by=<type>
  • population: the number of people, from WorldPop
  • census: a block with residents and households (counts), age_0_15_share, age_16_34_share, age_65_plus_share, private_renter_share and no_car_share (shares from 0 to 1), and net_household_income (in local currency per year)

census is null where the census has no data for the H3 cell, and missing gives the reason: no_residents when WorldPop also counts nobody there, or outside_source_coverage otherwise. A single field, such as census.net_household_income, can be null in the same way.

In totals, the rollup block shows how each field is added up. People, residents, households and cell_count use sum, the age shares use population_weighted_mean, and renting, cars and income use household_weighted_mean.

Errors

CodeHTTPWhen
invalid_min_population400min_population is negative or not an integer.

The endpoint can also return any of the error codes listed under Location, Per-cell endpoints and Paging.

1. Send one cell, get one row
Copy link

Put the id of one H3 cell in cells. You get back one row for that cell. population is WorldPop's estimate of the people who live there. The census block is a separate count from the census: residents, households, ages, renting, cars and income.

You send

curl -H "X-Application-Id: YOUR_APP_ID" -H "X-Api-Key: YOUR_APP_KEY" \
  "https://data.traveltimeapp.com/v1/demographics/cells?cells=89195da4d03ffff"

You get

{
  "resolution": 9,
  "results": [
    {
      "cell": "89195da4d03ffff",
      "population": 1274,
      "census": {
        "residents": 1004,
        "households": 401,
        "age_0_15_share": 0.198,
        "age_16_34_share": 0.371,
        "age_65_plus_share": 0.07,
        "private_renter_share": 0.242,
        "no_car_share": 0.766,
        "net_household_income": 37800
      }
    }
  ],
  "next_cursor": null,
  "sources": {
    "population": "worldpop_2020",
    "census": [
      "ons_census_2021_ew",
      "ons_income_fye2020_msoa"
    ]
  }
}

2. Send several cells, get one row for each
Copy link

Separate the cell ids with commas. You get one row for each cell, in the order you sent them. These seven cells lie between Euston and St Pancras. The map shades each cell by its population, from 138 to 2,218 people. Select a cell to see its row.

Request

curl -H "X-Application-Id: YOUR_APP_ID" -H "X-Api-Key: YOUR_APP_KEY" \
  "https://data.traveltimeapp.com/v1/demographics/cells?cells=89195da4d03ffff,89195da4d07ffff,89195da4d0bffff,89195da4d0fffff,89195da4d13ffff,89195da4d17ffff,89195da4d1bffff"
200 · 7 H3 cells

Shade = population1382,2187 H3 cells; click a cell to open its row.

3. Add them up: one row for all the cells
Copy link

Add group_by=all to get one total row instead. The same seven cells hold 9,587 people by WorldPop's estimate, and the census counts 6,869 residents in 2,813 households. cell_count says how many cells went into the total, and rollup says how each field was added up.

For a long list of cells, such as a whole borough or a catchment, send POST /v1/demographics/cells with the same fields in a JSON body. See Long requests.

You send

curl -H "X-Application-Id: YOUR_APP_ID" -H "X-Api-Key: YOUR_APP_KEY" \
  "https://data.traveltimeapp.com/v1/demographics/cells?cells=89195da4d03ffff,89195da4d07ffff,89195da4d0bffff,89195da4d0fffff,89195da4d13ffff,89195da4d17ffff,89195da4d1bffff&group_by=all"

You get

{
  "results": [
    {
      "population": 9587,
      "cell_count": 7,
      "census": {
        "residents": 6869,
        "households": 2813,
        "age_0_15_share": 0.137,
        "age_16_34_share": 0.436,
        "age_65_plus_share": 0.097,
        "private_renter_share": 0.245,
        "no_car_share": 0.764,
        "net_household_income": 39930
      }
    }
  ],
  "next_cursor": null,
  "rollup": {
    "cell_count": "sum",
    "population": "sum",
    "census.residents": "sum",
    "census.households": "sum",
    "census.age_0_15_share": "population_weighted_mean",
    "census.age_16_34_share": "population_weighted_mean",
    "census.age_65_plus_share": "population_weighted_mean",
    "census.private_renter_share": "household_weighted_mean",
    "census.no_car_share": "household_weighted_mean",
    "census.net_household_income": "household_weighted_mean"
  },
  "sources": {
    "population": "worldpop_2020",
    "census": [
      "ons_census_2021_ew",
      "ons_income_fye2020_msoa"
    ]
  }
}

4. No cell ids yet? Send an area
Copy link

Send bbox (south, west, north, east) for a box, or near and radius_m for a circle. You get one row for every cell in the area, and each row has its cell id. This box around King's Cross holds 39 cells.

Request

curl -H "X-Application-Id: YOUR_APP_ID" -H "X-Api-Key: YOUR_APP_KEY" \
  "https://data.traveltimeapp.com/v1/demographics/cells?bbox=51.522,-0.140,51.538,-0.110"
Examples

To find how many people live within 45 minutes of King's Cross by public transport, send the 8,526 H3 cells that the TravelTime API returns for that journey and ask for a single row. The answer is 6,075,716 residents in 2,419,928 households, 48% of which have no car. Use with the TravelTime API shows the call that returns the cells. The request body is shortened here.

Request

curl -X POST -H "X-Application-Id: YOUR_APP_ID" -H "X-Api-Key: YOUR_APP_KEY" -H "Content-Type: application/json" \
  -d '{"cells": ["89195db5377ffff", "89195da538bffff", "… 8,524 more"], "group_by": "all"}' \
  "https://data.traveltimeapp.com/v1/demographics/cells"

Response

{
  "results": [
    {
      "population": 6441313,
      "cell_count": 8526,
      "census": {
        "residents": 6075716,
        "households": 2419928,
        "age_0_15_share": 0.174,
        "age_16_34_share": 0.329,
        "age_65_plus_share": 0.107,
        "private_renter_share": 0.339,
        "no_car_share": 0.484,
        "net_household_income": 43657
      }
    }
  ],
  "next_cursor": null,
  "rollup": {
    "cell_count": "sum",
    "population": "sum",
    "census.residents": "sum",
    "census.households": "sum",
    "census.age_0_15_share": "population_weighted_mean",
    "census.age_16_34_share": "population_weighted_mean",
    "census.age_65_plus_share": "population_weighted_mean",
    "census.private_renter_share": "household_weighted_mean",
    "census.no_car_share": "household_weighted_mean",
    "census.net_household_income": "household_weighted_mean"
  },
  "sources": { "population": "worldpop_2020", "…": "…" }
}

Try these requests in the playground →