Use with the TravelTime API
Copy link

You can use the TravelTime API to find the H3 cells you can reach within a travel time, and the Data API to find out what is in them. You make both requests with your own keys and pass the cells from one to the other.

You need a TravelTime application id and key, which you can find on your account page. The same pair works for both APIs, but each API has its own rate limits.

1. Get the reachable H3 cells from POST /v4/h3/fast
Copy link

Request resolution 9, because every Data API dataset has it and cells uses it by default. This request returns the H3 cells within 45 minutes of King's Cross by public transport on a weekday morning. travel_time is in seconds.

Request

curl -X POST "https://api.traveltimeapp.com/v4/h3/fast" \
  -H "Content-Type: application/json" \
  -H "X-Application-Id: YOUR_APP_ID" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -d '{
    "resolution": 9,
    "properties": ["min"],
    "arrival_searches": {
      "one_to_many": [
        {
          "id": "kings-cross",
          "coords": { "lat": 51.5307, "lng": -0.1238 },
          "transportation": { "type": "public_transport" },
          "arrival_time_period": "weekday_morning",
          "travel_time": 2700
        }
      ]
    }
  }'

Response

{
  "results": [
    {
      "search_id": "kings-cross",
      "cells": [
        { "id": "89195db5377ffff", "properties": { "min": 2229 } },
        { "id": "89195da538bffff", "properties": { "min": 2231 } },
        "… 8,524 more"
      ]
    }
  ]
}

The response has one entry in results for each search. Each cell has an id and properties.min, which is its shortest travel time in seconds (mean and max are also available). The H3 Fast reference lists every parameter and the other transport types.

2. Send the cells to the Data API
Copy link

Send the id values from step 1 as cells. A 45-minute search returns thousands of them, so use POST. Every route that takes cells also accepts a POST request with the same fields as a JSON body, up to the cap given in Long requests.

For totals, compact the cells first with h3.compact_cells. For example, a 90-minute drive from Manchester Piccadilly is 138,190 H3 cells, which you can send as 14,980 ids with group_by=all.

Gyms in the catchment
Copy link

The 8,526 H3 cells from step 1 contain 3,173 places in the gym category, returned 100 per page. 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"], "category": "gym"}' \
  "https://data.traveltimeapp.com/v1/places"

Response

{
  "results": [
    {
      "id": "pl_gb_eebe766f-0e5b-4f8d-aa39-d309de4622c9",
      "name": "Northolt Leisure Centre",
      "category": "swimming_pool",
      "brand": null,
      "lat": 51.5491,
      "lng": -0.36757,
      "cell": "89195daea3bffff",
      "verified": true
    },
    {
      "id": "pl_gb_711c6900-311f-4932-8cf9-f538e026d478",
      "name": "PureGym",
      "category": "gym",
      "brand": "PureGym",
      "lat": 51.51235,
      "lng": -0.0369,
      "cell": "89194ad35abffff",
      "verified": false
    },
    "… 98 more on this page"
  ],
  "next_cursor": "eyJxIjoiNDI3NDU5YWVh…"
}

3. Send the same cells to other datasets
Copy link

Every per-cell route takes the same list of cells. All of them except /v1/boundaries/cells and /v1/custom-scores/cells return a single total with group_by=all. With within, /v1/proximity/cells keeps only the H3 cells that meet a condition.

How many people live within 45 minutes
Copy link

The catchment has 6,075,716 residents in 2,419,928 households, and 48% of those households have no car.

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,
        "no_car_share": 0.484,
        "…": "5 more"
      }
    }
  ],
  "next_cursor": null,
  "rollup": {
    "cell_count": "sum",
    "population": "sum",
    "census.residents": "sum",
    "census.households": "sum",
    "census.no_car_share": "household_weighted_mean",
    "…": "5 more"
  },
  "sources": {
    "population": "worldpop_2020",
    "census": ["ons_census_2021_ew", "ons_income_fye2020_msoa"]
  }
}

Which of them have a supermarket within a 5-minute walk
Copy link

1,912 of the 8,526 H3 cells have a supermarket within a 5-minute walk. They are returned 100 per page.

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"], "within": "walk.supermarket:300"}' \
  "https://data.traveltimeapp.com/v1/proximity/cells"

Response

{
  "within": "walk.supermarket:300",
  "resolution": 9,
  "results": [
    {
      "cell": "89194ad35abffff",
      "ratings": { "walk": 96, "transit": 82, "drive": 90 },
      "walk_s": { "supermarket": 238, "…": "7 more" },
      "drive_s": "…"
    },
    "… 99 more on this page"
  ],
  "next_cursor": "eyJxIjoiNTA3YWRhNzFj…"
}
RouteData for each H3 cell
POST /v1/places/cellsThe number of places, and category_counts with include=categories.
POST /v1/demographics/cellsPopulation (WorldPop) and the census block, with residents, households, age and renter shares, no_car_share and income.
POST /v1/proximity/cellsWalk, transit and drive ratings, walk_s and drive_s to eight everyday places, and within to filter the H3 cells.
POST /v1/neighbourhood/cellsNoise, air quality, flood zone, crime, deprivation and broadband.
POST /v1/open-spaces/cellsOpen space and green area in m², green share, land cover and a list of the open spaces by name.
POST /v1/boundaries/cellsEvery boundary the H3 cell is in, from ward to country. group_by is not supported.
POST /v1/transport/transit/stations/cells, POST /v1/transport/transit/lines/cellsStations and lines, with a count per mode.

There is a cap on the number of H3 cells in a per-cell response. Above the cap, use group_by=all (not available on /boundaries/cells), which accepts more res-9 cells. See Limits for the values, and Totals for how each field is added up.