Calculate walking time/distance matrix
Calculate distance and duration matrices between multiple coordinates for pedestrian routing. This shared service is independent of the selected BusMaps or WikiRoutes transit data host and is available with either capi-host value. Compatible with OSRM matrix API.
Response fields and units
| Field | Format / unit | Meaning |
|---|---|---|
durations[][] | seconds | Travel-time matrix |
distances[][] | meters | Travel-distance matrix |
sources[].distance, destinations[].distance | meters | Distance from each input coordinate to its snapped waypoint |
sources[].location, destinations[].location | [longitude, latitude] in decimal degrees | Snapped waypoint coordinates |
Parameters
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
sources | string | No | Semicolon-separated indices of source coordinates (0-based) | 0;1 |
destinations | string | No | Semicolon-separated indices of destination coordinates (0-based) | 0;1 |
annotations | string | No | Annotations to include in response | duration,distance |
Try It Out
Popular parameters
curl -H "capi-key: Bearer YOUR_API_KEY" \
-H "capi-host: busmaps.com" \
"https://capi.busmaps.com:8443/v1/pedestrian/matrix/-0.155956,51.540343;-0.069214,51.512959?sources=0;1&destinations=0;1&annotations=duration,distance"Response Example
{
"code": "Ok",
"sources": [
{
"hint": "wwLgpbUD4KUJAAAAFAAAAGcDAACIAAAApiyhP-2WNEAHNPNCZ86XQQkAAAAUAAAAZwMAAIgAAABBAAAAzJ79_3dxEgPvn_3_A3ISAw0ALxR6vxoo",
"distance": 25.505499,
"name": "Chalcot Crescent",
"location": [
-0.155956,
51.540343
]
},
{
"hint": "3V3dpRtk3aVwAAAAcgAAAPIBAAAAAAAAOP57QTj-e0HTbopCAAAAAHAAAAByAAAA8gEAAAAAAABBAAAAovH-_38GEgNP8f7_6AYSAwIA_wN6vxoo",
"distance": 13.025276,
"name": "",
"location": [
-0.069214,
51.512959
]
},
{
"hint": "nvPipR754qVrAAAAcQAAAAAAAAAAAAAAtW5uQeXGe0EAAAAAAAAAAGsAAABxAAAAAAAAAAAAAABBAAAA4gz-_4rwEQPyDP7_l_ARAwAA_wd6vxoo",
"distance": 1.823494,
"name": "",
"location": [
-0.127774,
51.507338
]
}
],
"destinations": [
{
"hint": "wwLgpbUD4KUJAAAAFAAAAGcDAACIAAAApiyhP-2WNEAHNPNCZ86XQQkAAAAUAAAAZwMAAIgAAABBAAAAzJ79_3dxEgPvn_3_A3ISAw0ALxR6vxoo",
"distance": 25.505499,
"name": "Chalcot Crescent",
"location": [
-0.155956,
51.540343
]
},
{
"hint": "3V3dpRtk3aVwAAAAcgAAAPIBAAAAAAAAOP57QTj-e0HTbopCAAAAAHAAAAByAAAA8gEAAAAAAABBAAAAovH-_38GEgNP8f7_6AYSAwIA_wN6vxoo",
"distance": 13.025276,
"name": "",
"location": [
-0.069214,
51.512959
]
},
{
"hint": "nvPipR754qVrAAAAcQAAAAAAAAAAAAAAtW5uQeXGe0EAAAAAAAAAAGsAAABxAAAAAAAAAAAAAABBAAAA4gz-_4rwEQPyDP7_l_ARAwAA_wd6vxoo",
"distance": 1.823494,
"name": "",
"location": [
-0.127774,
51.507338
]
}
],
"durations": [
[
0,
5769.3,
3388
],
[
5769.3,
0,
3337
],
[
3388,
3337,
0
]
],
"distances": [
[
0,
7981,
4692.4
],
[
7981,
0,
4627.8
],
[
4692.4,
4627.8,
0
]
]
}Response Schema
View JSON Schema
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Pedestrian Matrix Response",
"type": "object",
"properties": {
"code": {
"type": "string",
"description": "Response status code (Ok, NoTable, etc.)"
},
"sources": {
"type": "array",
"items": {
"type": "object",
"properties": {
"hint": {
"type": "string",
"description": "Opaque OSRM hint for re-snapping the waypoint"
},
"distance": {
"type": "number",
"description": "Distance in meters"
},
"location": {
"type": "array",
"items": {
"type": "number"
},
"description": "Point location. Coordinate arrays use [longitude, latitude] in decimal degrees; objects expose named latitude/longitude fields"
},
"name": {
"type": "string",
"description": "Display name"
}
},
"required": [
"hint",
"location",
"distance"
]
},
"description": "Array of source waypoint objects"
},
"destinations": {
"type": "array",
"items": {
"type": "object",
"properties": {
"hint": {
"type": "string",
"description": "Opaque OSRM hint for re-snapping the waypoint"
},
"distance": {
"type": "number",
"description": "Distance in meters"
},
"location": {
"type": "array",
"items": {
"type": "number"
},
"description": "Point location. Coordinate arrays use [longitude, latitude] in decimal degrees; objects expose named latitude/longitude fields"
},
"name": {
"type": "string",
"description": "Display name"
}
},
"required": [
"hint",
"location",
"distance"
]
},
"description": "Array of destination waypoint objects"
},
"durations": {
"type": "array",
"items": {
"type": "array",
"items": {
"type": [
"integer",
"number"
]
}
},
"description": "Matrix of durations in seconds (2D array)"
},
"distances": {
"type": "array",
"items": {
"type": "array",
"items": {
"type": [
"integer",
"number"
]
}
},
"description": "Matrix of distances in meters (2D array)"
}
},
"required": [
"code",
"sources",
"destinations",
"durations",
"distances"
]
}Response Codes
200
Successful matrix calculation400
Invalid input parameters422
No table could be constructed