Compass – GET /v1/compass
GET /v1/compass returns what the place card’s compass shows for a point: by default for
each of the eight everyday trips, the nearest place on foot with its walking minutes and its
direction from the point, and up to two more places within 30 minutes. No key is needed,
and a call counts as one request.
The places and minutes come from the map’s routing: for each H3 cell (resolution 10), the nearest three places of each type and the walking seconds to them, walking at 3.6 km/h and slowed on slopes (Tobler). The minutes are from the cell the point stands in, so two points in the same cell get the same minutes. The bearings are from the point itself.
curl "https://aportee.ca/v1/compass?lat=43.25085&lon=-79.81809&types=grocery,park"| Param | Required | Description |
|---|---|---|
lat |
yes | Latitude (WGS84). |
lon |
yes | Longitude (WGS84). |
types |
no | Some of grocery, pharmacy, convenience_store, bank, park, cafe, library and clinic and, where the data has them, school, elementary_school, secondary_school, childcare, playground and hospital, comma-separated. Defaults to the eight everyday trips. |
key |
no | API key. Prefer the X-Api-Key header. |
Response
Section titled “Response”{ "point": { "lat": 43.25085, "lon": -79.81809 }, "cell": { "lat": 43.25071, "lon": -79.81822 }, "trips": [{ "type": "grocery", "limit": 15, "reason": "ok", "nearest": { "name": "FreshCo", "minutes": 6, "bearing": 61.2, "direction": "NE", "within_limit": true, "lat": 43.25205, "lon": -79.81402 }, "next": [{ "name": "Food Basics", "minutes": 12, "bearing": 248.5, "direction": "W", "within_limit": true, "lat": 43.24877, "lon": -79.82511 }] }], "meta": { "data_version": "20261021-r37", "method": "R5 WALK, Tobler slope-adjusted; minutes from the H3 cell (res 10) the point stands in, bearings from the point", "attribution": "© OpenStreetMap contributors · Adapted from Statistics Canada · Overture Maps Foundation · ODbL (derived)" }}The values are illustrative. cell is the centre of the cell the minutes are from. Each
trip has:
| Field | Description |
|---|---|
type |
The everyday trip. |
limit |
The trip’s limit in minutes, as on the place card: 15 for most trips, 10 for a park, a convenience store or a playground, 20 for a library or a clinic, and 30 for a hospital. |
reason |
ok; no_access when no place of the type is within 60 minutes’ walk; not_computed when the cell has no walking time. |
nearest |
The nearest place, or null unless reason is ok. |
next |
Up to two more places, each within 30 minutes, nearest first. |
A place has its name (empty when it has none), its walking minutes, its bearing in
degrees clockwise from north, the nearest of the eight compass points as direction,
within_limit, and its lat and lon. The coordinates are where the walk to it ends,
such as a park’s nearest entrance.
A 200 includes an ETag. Send it back in If-None-Match to get a 304 while the query and
the map data are unchanged. A 304 is not counted.
The compass as a picture
Section titled “The compass as a picture”GET /v1/compass.svg and GET /v1/compass.png draw the same answer as the place card’s
compass: each trip’s nearest place as a petal in its direction, as far out as its walking
minutes, and its next places as small dots. Beside the dial, a list gives each place with its
direction and minutes; under it are a key, the data’s date and the credit. On the map a petal
bends with the turns of its walk; the picture draws each petal straight.
curl -o compass.png "https://aportee.ca/v1/compass.png?lat=43.25085&lon=-79.81809"Both take lat, lon and types as /v1/compass does, and:
| Param | Description |
|---|---|
lang |
en (default) or fr. |
theme |
light (default) or dark. |
label |
With a key only: the point’s name, at most 80 characters, printed as the picture’s title. Without it, the title says what the picture shows and the coordinates go under it. |
The SVG is one document, 680 pixels wide, its height growing with the number of trips. Its
labels are real text, and everything it draws is in the file, so it looks the same wherever it
opens. Each trip’s petal, dot, next places and row have data-trip (the type) and data-part
(petal, badge, next or row), for a page that highlights one trip.
The PNG is the same picture at 1,360 pixels wide, for apps that need a PNG, as most chat apps
do. A call for the SVG counts as one request, as /v1/compass does; a call for the PNG counts as
two, charged only when the picture comes back. Neither needs a key unless it has a label.
A refused request gets the same JSON error as /v1/compass. An unsupported lang, theme or
label is a 400, and a label without a key is a 401; neither is counted. A call for the
PNG can also get a 503, which isn’t counted. aportee.api.render_error means the picture
couldn’t be drawn just now: retry after Retry-After. aportee.api.unavailable means the PNG
can’t be drawn on this server; ask for the SVG.
Errors
Section titled “Errors”| Code | Meaning |
|---|---|
400 |
Missing lat/lon, or a type the compass doesn’t answer for in the served data; detail lists the ones it does. Not counted. |
404 |
aportee.api.no_street_nearby: no walkable street is near enough to route from, because the point is over water, outside Canada or far from a street or path. hint says what to try. |
422 |
lat or lon is not a number in range. Not counted. |
429 |
Rate limited. |
503 |
The compass data isn’t available for now. Not counted. |
For the minutes to other types, use /v1/access. The code for each
status is on Errors.