Skip to content

Commit 02aeffb

Browse files
feat: [places] add routing_parameters to SearchNearbyRequest and SearchTextRequest (#5688)
* feat: add `routing_parameters` to SearchNearbyRequest and SearchTextRequest feat: add `search_along_route_parameters` to SearchTextRequest feat: add `routing_summaries` to SearchNearbyResponse and SearchTextResponse docs: A comment for field `contextual_contents` in message `.google.maps.places.v1.SearchTextResponse` is changed to be more assertive docs: A comment for field `open_now` in message `.google.maps.places.v1.Place` is changed to clarify what it means with new-since-previous-comment current and secondary opening hours fields Introduces search along route and trip time features. PiperOrigin-RevId: 675760040 Source-Link: googleapis/googleapis@4221919 Source-Link: googleapis/googleapis-gen@9caa94e Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLW1hcHMtcGxhY2VzLy5Pd2xCb3QueWFtbCIsImgiOiI5Y2FhOTRlNmEzOTJhZWQ5ZmNjYTgxY2I4MDkxZmZlOWNkZmNlMDMzIn0= * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent 8661267 commit 02aeffb

15 files changed

Lines changed: 2931 additions & 8 deletions

packages/google-maps-places/protos/google/maps/places/v1/place.proto

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,10 @@ message Place {
167167
google.type.Date date = 1;
168168
}
169169

170-
// Is this place open right now? Always present unless we lack time-of-day
171-
// or timezone data for these opening hours.
170+
// Whether the opening hours period is currently active. For regular opening
171+
// hours and current opening hours, this field means whether the place is
172+
// open. For secondary opening hours and current secondary opening hours,
173+
// this field means whether the secondary hours of this place is active.
172174
optional bool open_now = 1;
173175

174176
// The periods that this place is open during the week. The periods are in

packages/google-maps-places/protos/google/maps/places/v1/places_service.proto

Lines changed: 73 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ import "google/maps/places/v1/contextual_content.proto";
2525
import "google/maps/places/v1/ev_charging.proto";
2626
import "google/maps/places/v1/geometry.proto";
2727
import "google/maps/places/v1/place.proto";
28+
import "google/maps/places/v1/polyline.proto";
29+
import "google/maps/places/v1/route_modifiers.proto";
30+
import "google/maps/places/v1/routing_preference.proto";
31+
import "google/maps/places/v1/routing_summary.proto";
32+
import "google/maps/places/v1/travel_mode.proto";
2833
import "google/type/latlng.proto";
2934

3035
option cc_enable_arenas = true;
@@ -87,6 +92,28 @@ service Places {
8792
}
8893
}
8994

95+
// Parameters to configure the routing calculations to the places in the
96+
// response, both along a route (where result ranking will be influenced) and
97+
// for calculating travel times on results.
98+
message RoutingParameters {
99+
// Optional. An explicit routing origin that overrides the origin defined in
100+
// the polyline. By default, the polyline origin is used.
101+
google.type.LatLng origin = 1 [(google.api.field_behavior) = OPTIONAL];
102+
103+
// Optional. The travel mode.
104+
TravelMode travel_mode = 2 [(google.api.field_behavior) = OPTIONAL];
105+
106+
// Optional. The route modifiers.
107+
RouteModifiers route_modifiers = 3 [(google.api.field_behavior) = OPTIONAL];
108+
109+
// Optional. Specifies how to compute the routing summaries. The server
110+
// attempts to use the selected routing preference to compute the route. The
111+
// traffic aware routing preference is only available for the `DRIVE` or
112+
// `TWO_WHEELER` `travelMode`.
113+
RoutingPreference routing_preference = 4
114+
[(google.api.field_behavior) = OPTIONAL];
115+
}
116+
90117
// Request proto for Search Nearby.
91118
//
92119
//
@@ -222,6 +249,10 @@ message SearchNearbyRequest {
222249

223250
// How results will be ranked in the response.
224251
RankPreference rank_preference = 9;
252+
253+
// Optional. Parameters that affect the routing to the search results.
254+
RoutingParameters routing_parameters = 10
255+
[(google.api.field_behavior) = OPTIONAL];
225256
}
226257

227258
// Response proto for Search Nearby.
@@ -230,6 +261,13 @@ message SearchNearbyResponse {
230261
// A list of places that meets user's requirements like places
231262
// types, number of places and specific location restriction.
232263
repeated Place places = 1;
264+
265+
// A list of routing summaries where each entry associates to the
266+
// corresponding place in the same index in the places field. If the routing
267+
// summary is not available for one of the places, it will contain an empty
268+
// entry. This list should have as many entries as the list of places if
269+
// requested.
270+
repeated RoutingSummary routing_summaries = 2;
233271
}
234272

235273
// Request proto for SearchText.
@@ -295,6 +333,25 @@ message SearchTextRequest {
295333
[(google.api.field_behavior) = OPTIONAL];
296334
}
297335

336+
// Specifies a precalculated polyline from the [Routes
337+
// API](https://developers.google.com/maps/documentation/routes) defining the
338+
// route to search. Searching along a route is similar to using the
339+
// `locationBias` or `locationRestriction` request option to bias the search
340+
// results. However, while the `locationBias` and `locationRestriction`
341+
// options let you specify a region to bias the search results, this option
342+
// lets you bias the results along a trip route.
343+
//
344+
// Results are not guaranteed to be along the route provided, but rather are
345+
// ranked within the search area defined by the polyline and, optionally, by
346+
// the `locationBias` or `locationRestriction` based on minimal detour times
347+
// from origin to destination. The results might be along an alternate route,
348+
// especially if the provided polyline does not define an optimal route from
349+
// origin to destination.
350+
message SearchAlongRouteParameters {
351+
// Required. The route polyline.
352+
Polyline polyline = 1 [(google.api.field_behavior) = REQUIRED];
353+
}
354+
298355
// Required. The text query for textual search.
299356
string text_query = 1 [(google.api.field_behavior) = REQUIRED];
300357

@@ -365,6 +422,14 @@ message SearchTextRequest {
365422

366423
// Optional. Set the searchable EV options of a place search request.
367424
EVOptions ev_options = 15 [(google.api.field_behavior) = OPTIONAL];
425+
426+
// Optional. Additional parameters for routing to results.
427+
RoutingParameters routing_parameters = 16
428+
[(google.api.field_behavior) = OPTIONAL];
429+
430+
// Optional. Additional parameters proto for searching along a route.
431+
SearchAlongRouteParameters search_along_route_parameters = 17
432+
[(google.api.field_behavior) = OPTIONAL];
368433
}
369434

370435
// Response proto for SearchText.
@@ -373,6 +438,13 @@ message SearchTextResponse {
373438
// A list of places that meet the user's text search criteria.
374439
repeated Place places = 1;
375440

441+
// A list of routing summaries where each entry associates to the
442+
// corresponding place in the same index in the places field. If the routing
443+
// summary is not available for one of the places, it will contain an empty
444+
// entry. This list will have as many entries as the list of places if
445+
// requested.
446+
repeated RoutingSummary routing_summaries = 2;
447+
376448
// Experimental: See
377449
// https://developers.google.com/maps/documentation/places/web-service/experimental/places-generative
378450
// for more details.
@@ -382,7 +454,7 @@ message SearchTextResponse {
382454
// that are relevant to the `text_query` in the request are preferred. If the
383455
// contextual content is not available for one of the places, it will return
384456
// non-contextual content. It will be empty only when the content is
385-
// unavailable for this place. This list should have as many entries as the
457+
// unavailable for this place. This list will have as many entries as the
386458
// list of places if requested.
387459
repeated ContextualContent contextual_contents = 3;
388460
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
// Copyright 2024 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
syntax = "proto3";
16+
17+
package google.maps.places.v1;
18+
19+
option cc_enable_arenas = true;
20+
option csharp_namespace = "Google.Maps.Places.V1";
21+
option go_package = "cloud.google.com/go/maps/places/apiv1/placespb;placespb";
22+
option java_multiple_files = true;
23+
option java_outer_classname = "PolylineProto";
24+
option java_package = "com.google.maps.places.v1";
25+
option objc_class_prefix = "GMPSV1";
26+
option php_namespace = "Google\\Maps\\Places\\V1";
27+
28+
// A route polyline. Only supports an [encoded
29+
// polyline](https://developers.google.com/maps/documentation/utilities/polylinealgorithm),
30+
// which can be passed as a string and includes compression with minimal
31+
// lossiness. This is the Routes API default output.
32+
message Polyline {
33+
// Encapsulates the type of polyline. Routes API output defaults to
34+
// `encoded_polyline`.
35+
oneof polyline_type {
36+
// An [encoded
37+
// polyline](https://developers.google.com/maps/documentation/utilities/polylinealgorithm),
38+
// as returned by the [Routes API by
39+
// default](https://developers.google.com/maps/documentation/routes/reference/rest/v2/TopLevel/computeRoutes#polylineencoding).
40+
// See the
41+
// [encoder](https://developers.google.com/maps/documentation/utilities/polylineutility)
42+
// and
43+
// [decoder](https://developers.google.com/maps/documentation/routes/polylinedecoder)
44+
// tools.
45+
string encoded_polyline = 1;
46+
}
47+
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
// Copyright 2024 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
syntax = "proto3";
16+
17+
package google.maps.places.v1;
18+
19+
import "google/api/field_behavior.proto";
20+
21+
option cc_enable_arenas = true;
22+
option csharp_namespace = "Google.Maps.Places.V1";
23+
option go_package = "cloud.google.com/go/maps/places/apiv1/placespb;placespb";
24+
option java_multiple_files = true;
25+
option java_outer_classname = "RouteModifiersProto";
26+
option java_package = "com.google.maps.places.v1";
27+
option objc_class_prefix = "GMPSV1";
28+
option php_namespace = "Google\\Maps\\Places\\V1";
29+
30+
// Encapsulates a set of optional conditions to satisfy when calculating the
31+
// routes.
32+
message RouteModifiers {
33+
// Optional. When set to true, avoids toll roads where reasonable, giving
34+
// preference to routes not containing toll roads. Applies only to the `DRIVE`
35+
// and `TWO_WHEELER` [`TravelMode`][google.maps.places.v1.TravelMode].
36+
bool avoid_tolls = 1 [(google.api.field_behavior) = OPTIONAL];
37+
38+
// Optional. When set to true, avoids highways where reasonable, giving
39+
// preference to routes not containing highways. Applies only to the `DRIVE`
40+
// and `TWO_WHEELER` [`TravelMode`][google.maps.places.v1.TravelMode].
41+
bool avoid_highways = 2 [(google.api.field_behavior) = OPTIONAL];
42+
43+
// Optional. When set to true, avoids ferries where reasonable, giving
44+
// preference to routes not containing ferries. Applies only to the `DRIVE`
45+
// and `TWO_WHEELER` [`TravelMode`][google.maps.places.v1.TravelMode].
46+
bool avoid_ferries = 3 [(google.api.field_behavior) = OPTIONAL];
47+
48+
// Optional. When set to true, avoids navigating indoors where reasonable,
49+
// giving preference to routes not containing indoor navigation. Applies only
50+
// to the `WALK` [`TravelMode`][google.maps.places.v1.TravelMode].
51+
bool avoid_indoor = 4 [(google.api.field_behavior) = OPTIONAL];
52+
}
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
// Copyright 2024 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
syntax = "proto3";
16+
17+
package google.maps.places.v1;
18+
19+
option cc_enable_arenas = true;
20+
option csharp_namespace = "Google.Maps.Places.V1";
21+
option go_package = "cloud.google.com/go/maps/places/apiv1/placespb;placespb";
22+
option java_multiple_files = true;
23+
option java_outer_classname = "RoutingPreferenceProto";
24+
option java_package = "com.google.maps.places.v1";
25+
option objc_class_prefix = "GMPSV1";
26+
option php_namespace = "Google\\Maps\\Places\\V1";
27+
28+
// A set of values that specify factors to take into consideration when
29+
// calculating the route.
30+
enum RoutingPreference {
31+
// No routing preference specified. Default to `TRAFFIC_UNAWARE`.
32+
ROUTING_PREFERENCE_UNSPECIFIED = 0;
33+
34+
// Computes routes without taking live traffic conditions into consideration.
35+
// Suitable when traffic conditions don't matter or are not applicable.
36+
// Using this value produces the lowest latency.
37+
// Note: For [`TravelMode`][google.maps.places.v1.TravelMode]
38+
// `DRIVE` and `TWO_WHEELER`, the route and duration chosen are based on road
39+
// network and average time-independent traffic conditions, not current road
40+
// conditions. Consequently, routes may include roads that are temporarily
41+
// closed. Results for a given
42+
// request may vary over time due to changes in the road network, updated
43+
// average traffic conditions, and the distributed nature of the service.
44+
// Results may also vary between nearly-equivalent routes at any time or
45+
// frequency.
46+
TRAFFIC_UNAWARE = 1;
47+
48+
// Calculates routes taking live traffic conditions into consideration.
49+
// In contrast to `TRAFFIC_AWARE_OPTIMAL`, some optimizations are applied to
50+
// significantly reduce latency.
51+
TRAFFIC_AWARE = 2;
52+
53+
// Calculates the routes taking live traffic conditions into consideration,
54+
// without applying most performance optimizations. Using this value produces
55+
// the highest latency.
56+
TRAFFIC_AWARE_OPTIMAL = 3;
57+
}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
// Copyright 2024 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
syntax = "proto3";
16+
17+
package google.maps.places.v1;
18+
19+
import "google/protobuf/duration.proto";
20+
21+
option cc_enable_arenas = true;
22+
option csharp_namespace = "Google.Maps.Places.V1";
23+
option go_package = "cloud.google.com/go/maps/places/apiv1/placespb;placespb";
24+
option java_multiple_files = true;
25+
option java_outer_classname = "RoutingSummaryProto";
26+
option java_package = "com.google.maps.places.v1";
27+
option objc_class_prefix = "GMPSV1";
28+
option php_namespace = "Google\\Maps\\Places\\V1";
29+
30+
// The duration and distance from the routing origin to a place in the
31+
// response, and a second leg from that place to the destination, if requested.
32+
// Note: Adding `routingSummaries` in the field mask without also including
33+
// either the `routingParameters.origin` parameter or the
34+
// `searchAlongRouteParameters.polyline.encodedPolyline` parameter in the
35+
// request causes an error.
36+
message RoutingSummary {
37+
// A leg is a single portion of a journey from one location to another.
38+
message Leg {
39+
// The time it takes to complete this leg of the trip.
40+
google.protobuf.Duration duration = 1;
41+
42+
// The distance of this leg of the trip.
43+
int32 distance_meters = 2;
44+
}
45+
46+
// The legs of the trip.
47+
//
48+
// When you calculate travel duration and distance from a set origin, `legs`
49+
// contains a single leg containing the duration and distance from the origin
50+
// to the destination. When you do a search along route, `legs` contains two
51+
// legs: one from the origin to place, and one from the place to the
52+
// destination.
53+
repeated Leg legs = 1;
54+
}

0 commit comments

Comments
 (0)