Skip to content

Walking routes – GET /v1/routes

GET /v1/routes returns the walk from a point to the nearest place of each requested type, as a GeoJSON FeatureCollection with one line per type. It needs a key, and each type routed counts as one request against the daily limit.

The walks are routed on the city’s walking network as the map routes them: walking at 3.6 km/h, slowed on slopes (Tobler). The nearest place is the one with the fewest walking minutes along the streets and paths. For the same point, you get the same place and minutes as from walk counts. A route can also end at a place with no name. It can also end at a place the walk counts leave out.

Terminal window
curl -H "X-Api-Key: $APORTEE_API_KEY" \
"https://aportee.ca/v1/routes?lat=43.25085&lon=-79.81809&types=grocery,school"
Param Required Description
lat yes Latitude (WGS84).
lon yes Longitude (WGS84).
types yes One to five comma-separated amenity types (see /v1/amenities).
key no API key. Prefer the X-Api-Key header.

Each feature’s geometry is the walked path, [lon, lat] pairs from where the point meets the street network to where the place does. Its properties:

Property Description
type The amenity type.
name The place’s mapped name; empty when it has none.
minutes Routed walking minutes.
distance_m Metres along the walked path.
times Seconds from the start at each vertex, from 0 to minutes × 60.

The routing gives each walk’s total minutes, slopes included, and times spreads them along the path by length: a vertex halfway along the path has half the walk’s seconds. The array has the shape that trip animation layers expect, such as deck.gl’s TripsLayer.

Where the routed path has a gap, the geometry is a MultiLineString and times is nested the same way. The time on both sides of the gap is the same.

{
"type": "FeatureCollection",
"point": { "lat": 43.25085, "lon": -79.81809 },
"features": [{
"type": "Feature",
"geometry": { "type": "LineString",
"coordinates": [[-79.81812, 43.25079], [-79.8159, 43.2501], [-79.81402, 43.25205]] },
"properties": { "type": "grocery", "name": "FreshCo", "minutes": 6, "distance_m": 448,
"times": [0, 154.6, 360] }
}],
"missing": [{ "type": "school", "reason": "unavailable",
"detail": "routing service busy; retry in a few seconds" }],
"meta": { "data_version": "20261021-r37",
"method": "R5 WALK, Tobler slope-adjusted; seconds along the path interpolated by length",
"attribution": "© OpenStreetMap contributors · Adapted from Statistics Canada · Overture Maps Foundation · ODbL (derived)" }
}

The values are illustrative.

A type with no line is in missing with a reason:

Reason Meaning
outside_coverage The point is outside the routed cities. Every type has this reason.
unreached No place of the type within 60 minutes’ walk.
no_path The place was found, but no path to it.
not_routed Routing doesn’t cover this type.
unavailable Routing gave no answer for the type. detail says why.

Routing covers twelve cities, listed under walk counts. unavailable comes with a detail, as in walk counts: routing service busy; retry in a few seconds, routing timed out, routing rate limit reached, daily routing cap reached, routing service returned an unexpected response or routing service unavailable. Match on reason: the wording of detail can change. When routing was busy, timed out or hit its per-address limit, the response sets Retry-After in seconds. After the daily cap, retry after 00:00 UTC. Once the point is outside coverage, or a type comes back unavailable, every later type comes back in missing with the same reason.

Each type routed counts as one request. The later types that share a reason are not counted.

Responses send Cache-Control: private, no-store. Asking for the same point again counts again.

Code Meaning
400 Missing lat/lon or types, more than five types, or an unknown type. Not counted.
401 No key, or a key that isn’t recognized.
422 lat or lon is not a number in range. Not counted.
429 Rate limited.
503 Routing is turned off on this server. Not counted.

The code for each status is on Errors.