@googlemaps/routing 2.1.0 → 2.1.1
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 +42 -143
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
[//]: # "This README.md file is auto-generated, all changes to this file will be lost."
|
|
2
|
-
[//]: # "
|
|
2
|
+
[//]: # "The comments you see below are used to generate those parts of the template in later states."
|
|
3
3
|
<img src="https://avatars2.githubusercontent.com/u/2810941?v=3&s=96" alt="Google Cloud Platform logo" title="Google Cloud Platform" align="right" height="96" width="96"/>
|
|
4
4
|
|
|
5
|
-
# [
|
|
6
|
-
|
|
7
|
-
[](https://cloud.google.com/terms/launch-stages)
|
|
8
|
-
[](https://www.npmjs.org/package/@googlemaps/routing)
|
|
9
|
-
|
|
5
|
+
# [Routes API: Nodejs Client][homepage]
|
|
10
6
|
|
|
7
|
+
This library is considered to be in **preview**. This means it is still a
|
|
8
|
+
work-in-progress and under active development. Any release is subject to
|
|
9
|
+
backwards-incompatible changes at any time.
|
|
11
10
|
|
|
11
|
+
[](https://www.npmjs.org/package/@googlemaps/routing)
|
|
12
12
|
|
|
13
|
-
client for Node.js
|
|
13
|
+
Routes API client for Node.js
|
|
14
14
|
|
|
15
|
+
[//]: # "partials.introduction"
|
|
15
16
|
|
|
16
17
|
A comprehensive list of changes in each version may be found in
|
|
17
|
-
[the CHANGELOG]
|
|
18
|
+
[the CHANGELOG][homepage_changelog].
|
|
18
19
|
|
|
19
|
-
* [
|
|
20
|
+
* [Routes API Nodejs Client API Reference](https://cloud.google.com/nodejs/docs/reference/routing/latest)
|
|
20
21
|
|
|
21
|
-
* [github.com/googleapis/google-cloud-node/packages/google-maps-routing](https://github.com/googleapis/google-cloud-node/tree/main/packages/google-maps-routing)
|
|
22
22
|
|
|
23
23
|
Read more about the client libraries for Cloud APIs, including the older
|
|
24
24
|
Google APIs Client Libraries, in [Client Libraries Explained][explained].
|
|
@@ -27,149 +27,60 @@ Google APIs Client Libraries, in [Client Libraries Explained][explained].
|
|
|
27
27
|
|
|
28
28
|
**Table of contents:**
|
|
29
29
|
|
|
30
|
-
|
|
31
30
|
* [Quickstart](#quickstart)
|
|
32
31
|
* [Before you begin](#before-you-begin)
|
|
33
32
|
* [Installing the client library](#installing-the-client-library)
|
|
34
|
-
|
|
35
|
-
* [Samples](#samples)
|
|
33
|
+
|
|
36
34
|
* [Versioning](#versioning)
|
|
37
35
|
* [Contributing](#contributing)
|
|
38
36
|
* [License](#license)
|
|
39
37
|
|
|
40
38
|
## Quickstart
|
|
41
|
-
|
|
42
39
|
### Before you begin
|
|
43
40
|
|
|
44
41
|
1. [Select or create a Cloud Platform project][projects].
|
|
45
42
|
1. [Enable billing for your project][billing].
|
|
46
|
-
1. [Enable the
|
|
43
|
+
1. [Enable the Routes API API][enable_api].
|
|
47
44
|
1. [Set up authentication][auth] so you can access the
|
|
48
45
|
API from your local workstation.
|
|
49
|
-
|
|
50
46
|
### Installing the client library
|
|
51
47
|
|
|
52
48
|
```bash
|
|
53
49
|
npm install @googlemaps/routing
|
|
54
50
|
```
|
|
55
51
|
|
|
52
|
+
## Terms of Service
|
|
56
53
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* This snippet has been automatically generated and should be regarded as a code template only.
|
|
62
|
-
* It will require modifications to work.
|
|
63
|
-
* It may require correct/in-range values for request initialization.
|
|
64
|
-
* TODO(developer): Uncomment these variables before running the sample.
|
|
65
|
-
*/
|
|
66
|
-
/**
|
|
67
|
-
* Required. Origin waypoint.
|
|
68
|
-
*/
|
|
69
|
-
// const origin = {}
|
|
70
|
-
/**
|
|
71
|
-
* Required. Destination waypoint.
|
|
72
|
-
*/
|
|
73
|
-
// const destination = {}
|
|
74
|
-
/**
|
|
75
|
-
* Optional. A set of waypoints along the route (excluding terminal points),
|
|
76
|
-
* for either stopping at or passing by. Up to 25 intermediate waypoints are
|
|
77
|
-
* supported.
|
|
78
|
-
*/
|
|
79
|
-
// const intermediates = 1234
|
|
80
|
-
/**
|
|
81
|
-
* Optional. Specifies the mode of transportation.
|
|
82
|
-
*/
|
|
83
|
-
// const travelMode = {}
|
|
84
|
-
/**
|
|
85
|
-
* Optional. Specifies how to compute the route. The server
|
|
86
|
-
* attempts to use the selected routing preference to compute the route. If
|
|
87
|
-
* the routing preference results in an error or an extra long latency, then
|
|
88
|
-
* an error is returned. In the future, we might implement a fallback
|
|
89
|
-
* mechanism to use a different option when the preferred option does not give
|
|
90
|
-
* a valid result. You can specify this option only when the `travel_mode` is
|
|
91
|
-
* `DRIVE` or `TWO_WHEELER`, otherwise the request fails.
|
|
92
|
-
*/
|
|
93
|
-
// const routingPreference = {}
|
|
94
|
-
/**
|
|
95
|
-
* Optional. Specifies your preference for the quality of the polyline.
|
|
96
|
-
*/
|
|
97
|
-
// const polylineQuality = {}
|
|
98
|
-
/**
|
|
99
|
-
* Optional. Specifies the preferred encoding for the polyline.
|
|
100
|
-
*/
|
|
101
|
-
// const polylineEncoding = {}
|
|
102
|
-
/**
|
|
103
|
-
* Optional. The departure time. If you don't set this value, then this value
|
|
104
|
-
* defaults to the time that you made the request. If you set this value to a
|
|
105
|
-
* time that has already occurred, then the request fails.
|
|
106
|
-
*/
|
|
107
|
-
// const departureTime = {}
|
|
108
|
-
/**
|
|
109
|
-
* Optional. Specifies whether to calculate alternate routes in addition to the route.
|
|
110
|
-
*/
|
|
111
|
-
// const computeAlternativeRoutes = true
|
|
112
|
-
/**
|
|
113
|
-
* Optional. A set of conditions to satisfy that affect the way routes are
|
|
114
|
-
* calculated.
|
|
115
|
-
*/
|
|
116
|
-
// const routeModifiers = {}
|
|
117
|
-
/**
|
|
118
|
-
* Optional. The BCP-47 language code, such as "en-US" or "sr-Latn". For more
|
|
119
|
-
* information, see
|
|
120
|
-
* http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. See
|
|
121
|
-
* Language Support (https://developers.google.com/maps/faq#languagesupport)
|
|
122
|
-
* for the list of supported languages. When you don't provide this value, the
|
|
123
|
-
* display language is inferred from the location of the route request.
|
|
124
|
-
*/
|
|
125
|
-
// const languageCode = 'abc123'
|
|
126
|
-
/**
|
|
127
|
-
* Optional. Specifies the units of measure for the display fields. This
|
|
128
|
-
* includes the `instruction` field in `NavigationInstruction`. The units of
|
|
129
|
-
* measure used for the route, leg, step distance, and duration are not
|
|
130
|
-
* affected by this value. If you don't provide this value, then the display
|
|
131
|
-
* units are inferred from the location of the request.
|
|
132
|
-
*/
|
|
133
|
-
// const units = {}
|
|
134
|
-
|
|
135
|
-
// Imports the Routing library
|
|
136
|
-
const {RoutesClient} = require('@googlemaps/routing').v2;
|
|
137
|
-
|
|
138
|
-
// Instantiates a client
|
|
139
|
-
const routingClient = new RoutesClient();
|
|
140
|
-
|
|
141
|
-
async function callComputeRoutes() {
|
|
142
|
-
// Construct request
|
|
143
|
-
const request = {
|
|
144
|
-
origin,
|
|
145
|
-
destination,
|
|
146
|
-
};
|
|
147
|
-
|
|
148
|
-
// Run request
|
|
149
|
-
const response = await routingClient.computeRoutes(request);
|
|
150
|
-
console.log(response);
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
callComputeRoutes();
|
|
154
|
-
|
|
155
|
-
```
|
|
54
|
+
`@googlemaps/routing` uses Google Maps Platform services. Use of Google
|
|
55
|
+
Maps Platform services through this library is subject to the
|
|
56
|
+
[Google Maps Platform Terms of Service][gmp-tos].
|
|
156
57
|
|
|
58
|
+
This library is not a Google Maps Platform Core Service.
|
|
59
|
+
Therefore, the Google Maps Platform Terms of Service (e.g., Technical
|
|
60
|
+
Support Services, Service Level Agreements, and Deprecation Policy)
|
|
61
|
+
do not apply to this library.
|
|
157
62
|
|
|
63
|
+
### European Economic Area (EEA) developers
|
|
158
64
|
|
|
159
|
-
|
|
65
|
+
If your billing address is in the European Economic Area, effective on
|
|
66
|
+
8 July 2025, the [Google Maps Platform EEA Terms of Service][gmp-tos-eea]
|
|
67
|
+
will apply to your use of the Services. Functionality varies by region.
|
|
68
|
+
[Learn more][gmp-tos-eea-faq].
|
|
160
69
|
|
|
161
|
-
|
|
70
|
+
[gmp-tos]: https://cloud.google.com/maps-platform/terms
|
|
71
|
+
[gmp-tos-eea]: https://cloud.google.com/terms/maps-platform/eea
|
|
72
|
+
[gmp-tos-eea-faq]: https://developers.google.com/maps/comms/eea/faq
|
|
162
73
|
|
|
163
|
-
|
|
164
|
-
| --------------------------- | --------------------------------- | ------ |
|
|
165
|
-
| Routes.compute_route_matrix | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-maps-routing/samples/generated/v2/routes.compute_route_matrix.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-maps-routing/samples/generated/v2/routes.compute_route_matrix.js,packages/google-maps-routing/samples/README.md) |
|
|
166
|
-
| Routes.compute_routes | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-maps-routing/samples/generated/v2/routes.compute_routes.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-maps-routing/samples/generated/v2/routes.compute_routes.js,packages/google-maps-routing/samples/README.md) |
|
|
167
|
-
| Quickstart | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-maps-routing/samples/quickstart.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-maps-routing/samples/quickstart.js,packages/google-maps-routing/samples/README.md) |
|
|
74
|
+
## Samples
|
|
168
75
|
|
|
76
|
+
Samples are in the [`samples/`][homepage_samples] directory. Each sample's `README.md` has instructions for running its sample.
|
|
169
77
|
|
|
78
|
+
| Sample | Source Code |
|
|
79
|
+
| --------------------------- | --------------------------------- |
|
|
80
|
+
| compute route matrix | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-maps-routing/samples/generated/v2/routes.compute_route_matrix.js) |
|
|
81
|
+
| compute routes | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-maps-routing/samples/generated/v2/routes.compute_routes.js) |
|
|
82
|
+
| maps | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-maps-routing/samples/generated/v2/snippet_metadata_google.maps.routing.v2.json) |
|
|
170
83
|
|
|
171
|
-
The [Google Maps Routing Node.js Client API Reference][client-docs] documentation
|
|
172
|
-
also contains samples.
|
|
173
84
|
|
|
174
85
|
## Supported Node.js Versions
|
|
175
86
|
|
|
@@ -196,41 +107,29 @@ for versions compatible with Node.js 8.
|
|
|
196
107
|
|
|
197
108
|
This library follows [Semantic Versioning](http://semver.org/).
|
|
198
109
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
This library is considered to be in **preview**. This means it is still a
|
|
206
|
-
work-in-progress and under active development. Any release is subject to
|
|
207
|
-
backwards-incompatible changes at any time.
|
|
208
|
-
|
|
209
|
-
|
|
210
110
|
More Information: [Google Cloud Platform Launch Stages][launch_stages]
|
|
211
111
|
|
|
212
112
|
[launch_stages]: https://cloud.google.com/terms/launch-stages
|
|
213
113
|
|
|
214
114
|
## Contributing
|
|
215
115
|
|
|
216
|
-
Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/google-cloud-node/blob/main/CONTRIBUTING.md).
|
|
116
|
+
Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-maps-routing/CONTRIBUTING.md).
|
|
217
117
|
|
|
218
|
-
Please note that this `README.md
|
|
118
|
+
Please note that this `README.md`
|
|
219
119
|
and a variety of configuration files in this repository (including `.nycrc` and `tsconfig.json`)
|
|
220
|
-
are generated from a central template.
|
|
221
|
-
to its templates in
|
|
222
|
-
[directory](https://github.com/googleapis/synthtool).
|
|
120
|
+
are generated from a central template.
|
|
223
121
|
|
|
224
122
|
## License
|
|
225
123
|
|
|
226
124
|
Apache Version 2.0
|
|
227
125
|
|
|
228
|
-
See [LICENSE](https://github.com/googleapis/google-cloud-node/blob/main/LICENSE)
|
|
229
|
-
|
|
230
|
-
[client-docs]: https://cloud.google.com/nodejs/docs/reference/routing/latest
|
|
126
|
+
See [LICENSE](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-maps-routing/LICENSE)
|
|
231
127
|
|
|
232
128
|
[shell_img]: https://gstatic.com/cloudssh/images/open-btn.png
|
|
233
129
|
[projects]: https://console.cloud.google.com/project
|
|
234
130
|
[billing]: https://support.google.com/cloud/answer/6293499#enable-billing
|
|
235
131
|
[enable_api]: https://console.cloud.google.com/flows/enableapi?apiid=routes.googleapis.com
|
|
236
132
|
[auth]: https://cloud.google.com/docs/authentication/external/set-up-adc-local
|
|
133
|
+
[homepage_samples]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-maps-routing/samples
|
|
134
|
+
[homepage_changelog]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-maps-routing/CHANGELOG.md
|
|
135
|
+
[homepage]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-maps-routing
|