From 104d44d5886a32bc61483d8d25d2557aee1dd5a6 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 27 Nov 2024 10:26:24 -0500 Subject: [PATCH] feat: [google-maps-routing] add API for shorter distance reference routes (#13306) - [ ] Regenerate this pull request now. PiperOrigin-RevId: 700387857 Source-Link: https://github.com/googleapis/googleapis/commit/4deb95d3bd31ed01524753dbdb94c2c52ce42103 Source-Link: https://github.com/googleapis/googleapis-gen/commit/a38a16c43c68681bbf5c0de7914b72790a4b6b2b Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLW1hcHMtcm91dGluZy8uT3dsQm90LnlhbWwiLCJoIjoiYTM4YTE2YzQzYzY4NjgxYmJmNWMwZGU3OTE0YjcyNzkwYTRiNmIyYiJ9 --------- Co-authored-by: Owl Bot --- .../google/maps/routing/gapic_version.py | 2 +- .../google/maps/routing_v2/gapic_version.py | 2 +- .../google/maps/routing_v2/types/route.py | 35 ++++++++++--------- .../maps/routing_v2/types/route_label.py | 4 +++ .../maps/routing_v2/types/routes_service.py | 27 +++++++++++--- ...ippet_metadata_google.maps.routing.v2.json | 2 +- 6 files changed, 49 insertions(+), 23 deletions(-) diff --git a/packages/google-maps-routing/google/maps/routing/gapic_version.py b/packages/google-maps-routing/google/maps/routing/gapic_version.py index 44e5c049e336..558c8aab67c5 100644 --- a/packages/google-maps-routing/google/maps/routing/gapic_version.py +++ b/packages/google-maps-routing/google/maps/routing/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "0.6.12" # {x-release-please-version} +__version__ = "0.0.0" # {x-release-please-version} diff --git a/packages/google-maps-routing/google/maps/routing_v2/gapic_version.py b/packages/google-maps-routing/google/maps/routing_v2/gapic_version.py index 44e5c049e336..558c8aab67c5 100644 --- a/packages/google-maps-routing/google/maps/routing_v2/gapic_version.py +++ b/packages/google-maps-routing/google/maps/routing_v2/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "0.6.12" # {x-release-please-version} +__version__ = "0.0.0" # {x-release-please-version} diff --git a/packages/google-maps-routing/google/maps/routing_v2/types/route.py b/packages/google-maps-routing/google/maps/routing_v2/types/route.py index c511e031d0d9..a1f0286ea2bf 100644 --- a/packages/google-maps-routing/google/maps/routing_v2/types/route.py +++ b/packages/google-maps-routing/google/maps/routing_v2/types/route.py @@ -110,15 +110,16 @@ class Route(proto.Message): localized_values (google.maps.routing_v2.types.Route.RouteLocalizedValues): Text representations of properties of the ``Route``. route_token (str): - A web-safe, base64-encoded route token that can be passed to - the Navigation SDK, that allows the Navigation SDK to - reconstruct the route during navigation, and, in the event - of rerouting, honor the original intention when you created - the route by calling ComputeRoutes. Customers should treat - this token as an opaque blob. It is not meant for reading or - mutating. NOTE: ``Route.route_token`` is only available for - requests that have set - ``ComputeRoutesRequest.routing_preference`` to + An opaque token that can be passed to `Navigation + SDK `__ + to reconstruct the route during navigation, and, in the + event of rerouting, honor the original intention when the + route was created. Treat this token as an opaque blob. Don't + compare its value across requests as its value may change + even if the service returns the exact same route. + + NOTE: ``Route.route_token`` is only available for requests + that have set ``ComputeRoutesRequest.routing_preference`` to ``TRAFFIC_AWARE`` or ``TRAFFIC_AWARE_OPTIMAL``. ``Route.route_token`` is not supported for requests that have Via waypoints. @@ -131,9 +132,10 @@ class RouteLocalizedValues(proto.Message): distance (google.type.localized_text_pb2.LocalizedText): Travel distance represented in text form. duration (google.type.localized_text_pb2.LocalizedText): - Duration taking traffic conditions into consideration, - represented in text form. Note: If you did not request - traffic information, this value will be the same value as + Duration, represented in text form and localized to the + region of the query. Takes traffic conditions into + consideration. Note: If you did not request traffic + information, this value is the same value as ``static_duration``. static_duration (google.type.localized_text_pb2.LocalizedText): Duration without taking traffic conditions @@ -408,9 +410,10 @@ class RouteLegLocalizedValues(proto.Message): distance (google.type.localized_text_pb2.LocalizedText): Travel distance represented in text form. duration (google.type.localized_text_pb2.LocalizedText): - Duration taking traffic conditions into consideration - represented in text form. Note: If you did not request - traffic information, this value will be the same value as + Duration, represented in text form and localized to the + region of the query. Takes traffic conditions into + consideration. Note: If you did not request traffic + information, this value is the same value as static_duration. static_duration (google.type.localized_text_pb2.LocalizedText): Duration without taking traffic conditions @@ -695,7 +698,7 @@ class RouteLegStepTransitDetails(proto.Message): This count includes the arrival stop, but excludes the departure stop. For example, if your route leaves from Stop A, passes through stops B and C, and arrives at stop D, - stop_count will return 3. + stop_count returns 3. trip_short_text (str): The text that appears in schedules and sign boards to identify a transit trip to passengers. The text should diff --git a/packages/google-maps-routing/google/maps/routing_v2/types/route_label.py b/packages/google-maps-routing/google/maps/routing_v2/types/route_label.py index 4d78bcc978cd..b72d12e4877d 100644 --- a/packages/google-maps-routing/google/maps/routing_v2/types/route_label.py +++ b/packages/google-maps-routing/google/maps/routing_v2/types/route_label.py @@ -47,11 +47,15 @@ class RouteLabel(proto.Enum): Fuel efficient route. Routes labeled with this value are determined to be optimized for Eco parameters such as fuel consumption. + SHORTER_DISTANCE (4): + Shorter travel distance route. This is an + experimental feature. """ ROUTE_LABEL_UNSPECIFIED = 0 DEFAULT_ROUTE = 1 DEFAULT_ROUTE_ALTERNATE = 2 FUEL_EFFICIENT = 3 + SHORTER_DISTANCE = 4 __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/packages/google-maps-routing/google/maps/routing_v2/types/routes_service.py b/packages/google-maps-routing/google/maps/routing_v2/types/routes_service.py index c71da30566bb..02becc425942 100644 --- a/packages/google-maps-routing/google/maps/routing_v2/types/routes_service.py +++ b/packages/google-maps-routing/google/maps/routing_v2/types/routes_service.py @@ -161,7 +161,9 @@ class ComputeRoutesRequest(proto.Message): calculation objective than the default route. For example a ``FUEL_EFFICIENT`` reference route calculation takes into account various parameters that would generate an optimal - fuel efficient route. + fuel efficient route. When using this feature, look for + [``route_labels``][google.maps.routing.v2.Route.route_labels] + on the resulting routes. extra_computations (MutableSequence[google.maps.routing_v2.types.ComputeRoutesRequest.ExtraComputation]): Optional. A list of extra computations which may be used to complete the request. Note: These @@ -199,12 +201,29 @@ class ReferenceRoute(proto.Enum): Not used. Requests containing this value fail. FUEL_EFFICIENT (1): - Fuel efficient route. Routes labeled with - this value are determined to be optimized for - parameters such as fuel consumption. + Fuel efficient route. + SHORTER_DISTANCE (2): + Route with shorter travel distance. This is an experimental + feature. + + For ``DRIVE`` requests, this feature prioritizes shorter + distance over driving comfort. For example, it may prefer + local roads instead of highways, take dirt roads, cut + through parking lots, etc. This feature does not return any + maneuvers that Google Maps knows to be illegal. + + For ``BICYCLE`` and ``TWO_WHEELER`` requests, this feature + returns routes similar to those returned when you don't + specify ``requested_reference_routes``. + + This feature is not compatible with any other travel modes, + via intermediate waypoints, or ``optimize_waypoint_order``; + such requests will fail. However, you can use it with any + ``routing_preference``. """ REFERENCE_ROUTE_UNSPECIFIED = 0 FUEL_EFFICIENT = 1 + SHORTER_DISTANCE = 2 class ExtraComputation(proto.Enum): r"""Extra computations to perform while completing the request. diff --git a/packages/google-maps-routing/samples/generated_samples/snippet_metadata_google.maps.routing.v2.json b/packages/google-maps-routing/samples/generated_samples/snippet_metadata_google.maps.routing.v2.json index ecfe37970694..b5ed5aca319c 100644 --- a/packages/google-maps-routing/samples/generated_samples/snippet_metadata_google.maps.routing.v2.json +++ b/packages/google-maps-routing/samples/generated_samples/snippet_metadata_google.maps.routing.v2.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-maps-routing", - "version": "0.6.12" + "version": "0.1.0" }, "snippets": [ {