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.
Required authentication header. The same application id as the TravelTime API.
Required authentication header.
GET /v1/boundariesBoundaries 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"| Namename | Typetype | Parent nameparent.name | Parent typeparent.type |
|---|---|---|---|
| Camden Square | ward | Camden | borough |
| Camden Town | ward | Camden | borough |
| Camden | borough | Greater London | region |
All 3 shown
Response
{
"results": [
{
"id": "gb-camden-square",
"name": "Camden Square",
"type": "ward",
"parent": {
"id": "gb-camden",
"name": "Camden",
"type": "borough"
}
},
"… 2 more rows"
],
"next_cursor": null
}Drop a pin and get every boundary it sits in, largest first: United Kingdom, England, Greater London, Camden, King's Cross ward.
Request
curl -H "X-Application-Id: YOUR_APP_ID" -H "X-Api-Key: YOUR_APP_KEY" \
"https://data.traveltimeapp.com/v1/boundaries?at=51.5307,-0.1238"| Namename | Typetype | Parent nameparent.name | Parent typeparent.type |
|---|---|---|---|
| United Kingdom | country | — | — |
| England | nation | United Kingdom | country |
| Greater London | region | England | nation |
| Camden | borough | Greater London | region |
| King's Cross | ward | Camden | borough |
All 5 shown
Response
{
"results": [
{
"id": "gb",
"name": "United Kingdom",
"type": "country",
"parent": null
},
"… 4 more rows"
],
"next_cursor": null
}Every borough inside Greater London: 32 of them. parent lists what sits inside a boundary; without type it lists everything inside it, wards included.
Request
curl -H "X-Application-Id: YOUR_APP_ID" -H "X-Api-Key: YOUR_APP_KEY" \
"https://data.traveltimeapp.com/v1/boundaries?parent=gb-greater-london&type=borough"| Namename | Typetype | Parent nameparent.name | Parent typeparent.type |
|---|---|---|---|
| Barking and Dagenham | borough | Greater London | region |
| Barnet | borough | Greater London | region |
| Bexley | borough | Greater London | region |
| Brent | borough | Greater London | region |
| Bromley | borough | Greater London | region |
5 of 32 shown · the other 27 are in the response, all 32 in the playground
Response
{
"results": [
{
"id": "gb-barking-and-dagenham",
"name": "Barking and Dagenham",
"type": "borough",
"parent": {
"id": "gb-greater-london",
"name": "Greater London",
"type": "region"
}
},
"… 31 more rows"
],
"next_cursor": null
}| Parameter | Type | Default | What it does | Example |
|---|---|---|---|---|
q | text | — | Search by name, best match first. Needs country. | q=camden |
country | country id | — | The country to search with q; on its own, every boundary in the country. | country=gb |
at | lat,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 |
parent | boundary id | — | The boundaries inside this one. | parent=gb-greater-london |
type | boundary 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
| Code | HTTP | When |
|---|---|---|
location_required | 400 | None of at, parent or country, and not type=country alone; or q without country. |
too_many_locations | 400 | Two of at, parent and country at once. |
invalid_parent | 400 | No boundary with that id, or a National Park or Landscape, which holds none; use at. |
invalid_type | 400 | Not a boundary type the country has; allowed lists them. |
… and every Where and Paging code.
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.
Request
curl -H "X-Application-Id: YOUR_APP_ID" -H "X-Api-Key: YOUR_APP_KEY" \
"https://data.traveltimeapp.com/v1/boundaries/gb-camden?include=cells"| Idid | gb-camden |
|---|---|
| Namename | Camden |
| Typetype | borough |
| Parent idparent.id | gb-greater-london |
| Parent nameparent.name | Greater London |
| Parent typeparent.type | region |
| Official nameofficial_name | London Borough of Camden |
| Bbox eastbbox.east | -0.1052 |
| Bbox southbbox.south | 51.5129 |
| Bbox northbbox.north | 51.5728 |
| Bbox westbbox.west | -0.2143 |
| Codes osmcodes.osm | R51827 |
| Codes onscodes.ons | E09000007 |
| Cellscells | 233 hexagons |
Response
{
"id": "gb-camden",
"name": "Camden",
"type": "borough",
"parent": {
"id": "gb-greater-london",
"name": "Greater London",
"type": "region"
},
"official_name": "London Borough of Camden",
"bbox": {
"east": -0.1052,
"south": 51.5129,
"north": 51.5728,
"west": -0.2143
},
"codes": {
"osm": "R51827",
"ons": "E09000007"
},
"cells": [
"89194ad324bffff",
"89194ad3253ffff",
"89194ad325bffff",
"89194ad32c3ffff",
"89194ad32cbffff",
"… 228 more"
]
}| Parameter | Type | Default | What it does | Example |
|---|---|---|---|---|
include | cells | — | 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
| Code | HTTP | When |
|---|---|---|
not_found | 404 | No boundary with this id. |
invalid_include | 400 | include is anything other than cells. |
too_many_cells | 400 | include=cells on a boundary of more than 100,000 hexagons, such as a country; allowed_max gives the cap. |
cells_unindexed | 503 | include=cells, but this boundary's hexagons are not indexed yet. |
GET /v1/boundaries/cellsFor 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.
Request
curl -H "X-Application-Id: YOUR_APP_ID" -H "X-Api-Key: YOUR_APP_KEY" \
"https://data.traveltimeapp.com/v1/boundaries/cells?cells=89195da4d03ffff,89195da4d07ffff,89195da4d0bffff,89195da4d0fffff,89195da4d13ffff,89195da4d17ffff,89195da4d1bffff"7 hexagons; a hexagon opens its row.Drawn from the response on this page; the playground runs it live.
| Hexagoncell | Boundariesboundaries | Map |
|---|---|---|
| 89195da4d03ffff | St Pancras & Somers Town, Camden, Greater London +2 | |
| 89195da4d07ffff | Bloomsbury, Camden, Greater London +2 | |
| 89195da4d0bffff | Regent's Park, Camden, Greater London +2 | |
| 89195da4d0fffff | Bloomsbury, Camden, Greater London +2 | |
| 89195da4d13ffff | St Pancras & Somers Town, Camden, Greater London +2 |
5 of 7 shown · the other 2 are in the response, all 7 in the playground
Response
{
"resolution": 9,
"results": [
{
"cell": "89195da4d03ffff",
"boundaries": [
{
"id": "gb-st-pancras-somers-town",
"name": "St Pancras & Somers Town",
"type": "ward"
},
"… 4 more rows"
]
},
"… 6 more rows"
],
"next_cursor": null
}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
| Code | HTTP | When |
|---|---|---|
location_required | 400 | No cells; bbox, near and at do not work on this route. |
invalid_resolution | 400 | resolution other than 9; allowed is [9]. |
invalid_cell_resolution | 400 | cells that are not resolution 9. |
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"| Namename | Typetype | Parent nameparent.name | Parent typeparent.type |
|---|---|---|---|
| Camden Square | ward | Camden | borough |
| Camden Town | ward | Camden | borough |
| Camden | borough | Greater London | region |
All 3 shown
Response
{
"results": [
{
"id": "gb-camden-square",
"name": "Camden Square",
"type": "ward",
"parent": {
"id": "gb-camden",
"name": "Camden",
"type": "borough"
}
},
"… 2 more rows"
],
"next_cursor": null
}