Skip to main content

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/sdk/browser, checked against version 0.2.0.

Signature​

import type { RoutingProvider } from "@mapcairn/sdk/browser";

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.

Properties​

credits​

readonly credits?: readonly RoutingCredit[];

The credits the map lists while a route or area from this provider is drawn. Read each time the credits are drawn. Leave it out when the host lists them itself or the service asks for none. In releases after 0.2.0, the interface <mapcairn-map> draws reads it; an app that lays out its own Attribution passes the credits there.

Methods​

reachableArea​

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​

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​