mapricot 0.8.0 → 0.10.0
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.
- package/README.md +3 -1
- package/dist/index.d.ts +19 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -34,7 +34,7 @@ Methods are grouped by product, the same way as the API's paths. Each returns th
|
|
|
34
34
|
| `client.geocoding.reverse(lat, lon, { limit, lang })` | [`GET /geocoding/v1/reverse`](https://mapricot.com/docs/geocoding/#find-the-address-at-a-point) |
|
|
35
35
|
| `client.places.nearby(lat, lon, { category, radius, limit, lang })` | [`GET /places/v1/nearby`](https://mapricot.com/docs/places/#list-places-around-a-point) |
|
|
36
36
|
| `client.places.get(id, { lang })` | [`GET /places/v1/{id}`](https://mapricot.com/docs/places/#look-up-a-saved-place) |
|
|
37
|
-
| `client.routing.route(waypoints, { mode, geometries })` | [`POST /routing/v1/route`](https://mapricot.com/docs/routing/#get-a-route) |
|
|
37
|
+
| `client.routing.route(waypoints, { mode, geometries, steps, lang })` | [`POST /routing/v1/route`](https://mapricot.com/docs/routing/#get-a-route) |
|
|
38
38
|
| `client.routing.isochrone(location, minutes, { mode })` | [`POST /routing/v1/isochrone`](https://mapricot.com/docs/routing/#get-an-isochrone) |
|
|
39
39
|
| `client.ipGeolocation.lookup(ip)` | [`GET /ip-geolocation/v1/{ip}`](https://mapricot.com/docs/ip-geolocation/#look-up-an-address) |
|
|
40
40
|
| `client.account()` | `GET /account`, which checks a key and is never billed |
|
|
@@ -64,6 +64,8 @@ const area = await client.routing.isochrone({ lat: 45.5189, lon: -122.6793 }, [5
|
|
|
64
64
|
map.addSource("reach", { type: "geojson", data: area });
|
|
65
65
|
```
|
|
66
66
|
|
|
67
|
+
Pass `steps: true` and each leg's `steps` has its turn-by-turn directions: an `instruction`, its distance and time, and its `lat` and `lon`. They're in English unless you pass `lang`, such as `lang: "fr"`.
|
|
68
|
+
|
|
67
69
|
If your app shows results, show the credits in each response's `attribution`.
|
|
68
70
|
|
|
69
71
|
## Errors and retries
|
package/dist/index.d.ts
CHANGED
|
@@ -22,6 +22,12 @@ export interface Place {
|
|
|
22
22
|
lon: number;
|
|
23
23
|
address?: Address;
|
|
24
24
|
categories?: string[];
|
|
25
|
+
phones?: string[];
|
|
26
|
+
websites?: string[];
|
|
27
|
+
socials?: string[];
|
|
28
|
+
brand?: string;
|
|
29
|
+
/** OpenStreetMap's `opening_hours` syntax, such as `Mo-Fr 08:00-18:00`. */
|
|
30
|
+
openingHours?: string;
|
|
25
31
|
distanceMeters?: number;
|
|
26
32
|
source: string;
|
|
27
33
|
}
|
|
@@ -36,6 +42,17 @@ export interface PlaceResult {
|
|
|
36
42
|
export interface Leg {
|
|
37
43
|
distanceMeters: number;
|
|
38
44
|
durationSeconds: number;
|
|
45
|
+
/** Turn-by-turn directions, in order, when the route was asked for with `steps: true`. The last step is the arrival. */
|
|
46
|
+
steps?: Step[];
|
|
47
|
+
}
|
|
48
|
+
/** One maneuver, and the stretch from it to the next. */
|
|
49
|
+
export interface Step {
|
|
50
|
+
instruction: string;
|
|
51
|
+
distanceMeters: number;
|
|
52
|
+
durationSeconds: number;
|
|
53
|
+
/** Where the maneuver is, on the route's path. */
|
|
54
|
+
lat: number;
|
|
55
|
+
lon: number;
|
|
39
56
|
}
|
|
40
57
|
export interface Route {
|
|
41
58
|
distanceMeters: number;
|
|
@@ -158,6 +175,8 @@ export declare class Mapricot {
|
|
|
158
175
|
route: (waypoints: Point[], { signal, ...options }?: RequestOptions & {
|
|
159
176
|
mode?: "drive" | "walk" | "bicycle";
|
|
160
177
|
geometries?: "polyline" | "polyline6" | "geojson";
|
|
178
|
+
steps?: boolean;
|
|
179
|
+
lang?: string;
|
|
161
180
|
}) => Promise<Routes>;
|
|
162
181
|
/** The areas reachable from a location within 1 to 4 times, each 1 to 60 minutes. */
|
|
163
182
|
isochrone: (location: Point, minutes: number[], { signal, ...options }?: RequestOptions & {
|