Boundaries
Copy link

Countries, nations, regions, counties, boroughs, wards and National Parks: which ones a place is in, and the ids that split totals with group_by on every /cells route.

Questions this page answers

  • Which borough is this address in?
  • What are the boroughs of London?
  • What is the id for Camden?

Boundaries come from OpenStreetMap relations and ONS wards. codes.osm is the OpenStreetMap id, on all but ONS wards; codes.ons is the GSS code, where there is one. /v1/catalog/gb lists the types a country has and updated_at, the date they were last loaded. A country with no boundaries loaded answers with empty lists and not_found; one loaded before boundary ids existed answers slug_unindexed, 503, until it is reloaded.

Request headers
Copy link

Required authentication header. The same application id as the TravelTime API.

string

Required authentication header.

A list of boundaries
Copy link

GET /v1/boundaries

Boundaries matching a name, holding a point (largest first), inside a boundary, or in a country; type narrows any of them.

Type a name, get ids you can use everywhere: the borough gb-camden and the two wards named after it. Add type=borough to keep only the borough.

Request

curl -H "X-Application-Id: YOUR_APP_ID" -H "X-Api-Key: YOUR_APP_KEY" \
  "https://data.traveltimeapp.com/v1/boundaries?q=camden&country=gb"
200 · 3 boundaries, one page
NamenameTypetypeParent nameparent.nameParent typeparent.type
Camden SquarewardCamdenborough
Camden TownwardCamdenborough
CamdenboroughGreater Londonregion

All 3 shown

Drop a pin and get every boundary it sits in, largest first: United Kingdom, England, Greater London, Camden, King's Cross ward.

Every borough inside Greater London: 32 of them. parent lists what sits inside a boundary; without type it lists everything inside it, wards included.

Parameters
Copy link

ParameterTypeDefaultWhat it doesExample
qtext—Search by name, best match first. Needs country.q=camden
countrycountry id—The country to search with q; on its own, every boundary in the country.country=gb
atlat,lng—The boundaries of the hexagon holding this point, largest first: country down to ward, each inside the one before, then National Parks and National Landscapes.at=51.5307,-0.1238
parentboundary id—The boundaries inside this one.parent=gb-greater-london
typeboundary type—Only this type. GB has country, nation, region, county, borough, ward, national_park and national_landscape; /v1/catalog/{country} lists them. type=country alone lists the countries.type=borough

Also takes Paging: limit, cursor.

Each row: id (gb-camden), name, type, parent as {id, name, type}, null for a country.

Errors

CodeHTTPWhen
location_required400None of at, parent or country, and not type=country alone; or q without country.
too_many_locations400Two of at, parent and country at once.
invalid_parent400No boundary with that id, or a National Park or Landscape, which holds none; use at.
invalid_type400Not a boundary type the country has; allowed lists them.

… and every Where and Paging code.

One boundary
Copy link

GET /v1/boundaries/{id}

One boundary with its official name, bounding box and official codes. /v1/boundaries/gb is the country itself.

Camden by id. include=cells adds the resolution-9 hexagons that make it up, 233 of them: the list to send as cells to any /cells route.

Parameters
Copy link

ParameterTypeDefaultWhat it doesExample
includecells—Adds cells, its resolution-9 hexagons.include=cells

Each row: the list row plus official_name, bbox as {south, west, north, east} in degrees, and codes.osm and codes.ons (each where it applies); cells with include=cells.

Errors

CodeHTTPWhen
not_found404No boundary with this id.
invalid_include400include is anything other than cells.
too_many_cells400include=cells on a boundary of more than 100,000 hexagons, such as a country; allowed_max gives the cap.
cells_unindexed503include=cells, but this boundary's hexagons are not indexed yet.

The boundaries each hexagon is in
Copy link

GET /v1/boundaries/cells

For each hexagon you send, in the order sent, every boundary it sits in, smallest first, then National Parks and National Landscapes. A hexagon on a border takes its ward and that ward's borough. Resolution 9 only. There is no group_by. POST /v1/boundaries/cells takes the same fields as JSON, for long lists (Long requests).

Seven hexagons around Euston Square: each comes back with its ward, borough, region, nation and country.

Also takes Where: cells only · Paging: limit, cursor · Output: format · Long requests: the POST body.

Each row: cell and boundaries, a list of {id, name, type} smallest first; the response carries resolution (always 9) at the top level.

Errors

CodeHTTPWhen
location_required400No cells; bbox, near and at do not work on this route.
invalid_resolution400resolution other than 9; allowed is [9].
invalid_cell_resolution400cells that are not resolution 9.

… and every Where and Paging code.

Request

curl -H "X-Application-Id: YOUR_APP_ID" -H "X-Api-Key: YOUR_APP_KEY" \
  "https://data.traveltimeapp.com/v1/boundaries?q=camden&country=gb"
200 · 3 boundaries, one page
NamenameTypetypeParent nameparent.nameParent typeparent.type
Camden SquarewardCamdenborough
Camden TownwardCamdenborough
CamdenboroughGreater Londonregion

All 3 shown