@unmap/routing 0.0.1 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +30 -0
  2. package/package.json +2 -2
package/README.md ADDED
@@ -0,0 +1,30 @@
1
+ # @unmap/routing
2
+
3
+ Typed client for the [unmap](https://unmap.dev) routing API: point-to-point routes and
4
+ travel-time isochrones over the Canadian road graph, for driving, cycling, and walking. No map
5
+ dependency; works in Node and the browser.
6
+
7
+ ```bash
8
+ npm i @unmap/routing
9
+ ```
10
+
11
+ ```ts
12
+ import { Router } from '@unmap/routing'
13
+
14
+ const router = new Router({ key: 'um_live_...' })
15
+
16
+ const route = await router.route([-114.07, 51.05], [-113.99, 51.05], { mode: 'auto' })
17
+ route.distanceMeters // integer metres
18
+ route.durationSeconds // integer seconds
19
+ route.geometry // GeoJSON LineString, [lng, lat] coordinates
20
+
21
+ const bands = await router.isochrone([-114.07, 51.05], { minutes: [10, 20], mode: 'pedestrian' })
22
+ bands.features // one GeoJSON polygon per minute value
23
+ ```
24
+
25
+ Coordinates are always `[lng, lat]`. `mode` is `'auto' | 'bicycle' | 'pedestrian'` and defaults
26
+ to `'auto'`; `minutes` is required and takes up to four values of at most 120 minutes. Both methods accept an
27
+ `AbortSignal` as `signal`. A non-2xx response throws a `RouterError` carrying the HTTP `status`.
28
+
29
+ Parameters, response shapes, and error bodies are documented at
30
+ [unmap.dev/docs/routing-api](https://unmap.dev/docs/routing-api).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unmap/routing",
3
- "version": "0.0.1",
3
+ "version": "0.0.3",
4
4
  "description": "Typed client for the unmap routing API (route + isochrone)",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -20,7 +20,7 @@
20
20
  "access": "public"
21
21
  },
22
22
  "dependencies": {
23
- "@unmap/core": "0.0.1"
23
+ "@unmap/core": "0.1.0"
24
24
  },
25
25
  "devDependencies": {
26
26
  "tsup": "^8.3.0",