# RoutingProvider

Finds routes and travel-time areas. Implementations reject with a
`RoutingError` (`network`, `invalid`, `no-route`, `rate-limited`,
`unsupported`, or `aborted` when the signal fires first). The ui treats
`aborted` as "ignore this result".

This is an interface exported by `@mapcairn/core`, checked against version 0.2.0.

## Signature

```ts
import type { RoutingProvider } from "@mapcairn/core";
 
interface RoutingProvider
```

## Description

MapCairn ships no provider. A host supplies one for the service it chooses,
and lists on its privacy page what the provider sends: the stops or the
origin, and the mode. A service's own usage limits belong to its
implementation, since every caller shares them. The service is optional:
a host that supplies none gets no routing, and the ui must cope.

## Methods

### reachableArea

```ts
reachableArea(request: ReachableAreaRequest): Promise<ReachableAreaResult>;
```

Finds the area reachable from `origin` within `minutes`. Rejects with
`invalid` for a position that is not on the globe or minutes that are
not greater than zero, `no-route` when nothing is reachable, and
`unsupported` for a mode the provider does not offer.

- `request` (`ReachableAreaRequest`)

### route

```ts
route(request: RouteRequest): Promise<RouteResult>;
```

Finds the route through `stops` in order. Rejects with `invalid` for
fewer than two stops or a position that is not on the globe, `no-route`
when no route links the stops, and `unsupported` for a mode the provider
does not offer.

- `request` (`RouteRequest`)

## See also

- [`ReachableAreaRequest`](https://docs.mapcairn.com/api/core/ReachableAreaRequest.md)
- [`ReachableAreaResult`](https://docs.mapcairn.com/api/core/ReachableAreaResult.md)
- [`RouteRequest`](https://docs.mapcairn.com/api/core/RouteRequest.md)
- [`RouteResult`](https://docs.mapcairn.com/api/core/RouteResult.md)

Source: [packages/core/src/ports/routing.ts:107](https://github.com/MapCairn/mapcairn/blob/main/packages/core/src/ports/routing.ts#L107)
