diff --git a/packages/google-maps-routing/google/maps/routing/__init__.py b/packages/google-maps-routing/google/maps/routing/__init__.py index 3525247e0abd..ef47c5e1bb55 100644 --- a/packages/google-maps-routing/google/maps/routing/__init__.py +++ b/packages/google-maps-routing/google/maps/routing/__init__.py @@ -25,6 +25,10 @@ FallbackReason, FallbackRoutingMode, ) +from google.maps.routing_v2.types.geocoding_results import ( + GeocodedWaypoint, + GeocodingResults, +) from google.maps.routing_v2.types.location import Location from google.maps.routing_v2.types.maneuver import Maneuver from google.maps.routing_v2.types.navigation_instruction import NavigationInstruction @@ -68,6 +72,8 @@ "FallbackInfo", "FallbackReason", "FallbackRoutingMode", + "GeocodedWaypoint", + "GeocodingResults", "Location", "Maneuver", "NavigationInstruction", diff --git a/packages/google-maps-routing/google/maps/routing_v2/__init__.py b/packages/google-maps-routing/google/maps/routing_v2/__init__.py index 7a01b221ac2e..4c3204fd4875 100644 --- a/packages/google-maps-routing/google/maps/routing_v2/__init__.py +++ b/packages/google-maps-routing/google/maps/routing_v2/__init__.py @@ -20,6 +20,7 @@ from .services.routes import RoutesAsyncClient, RoutesClient from .types.fallback_info import FallbackInfo, FallbackReason, FallbackRoutingMode +from .types.geocoding_results import GeocodedWaypoint, GeocodingResults from .types.location import Location from .types.maneuver import Maneuver from .types.navigation_instruction import NavigationInstruction @@ -61,6 +62,8 @@ "FallbackInfo", "FallbackReason", "FallbackRoutingMode", + "GeocodedWaypoint", + "GeocodingResults", "Location", "Maneuver", "NavigationInstruction", diff --git a/packages/google-maps-routing/google/maps/routing_v2/services/routes/async_client.py b/packages/google-maps-routing/google/maps/routing_v2/services/routes/async_client.py index a026c56d4229..c27576e1df92 100644 --- a/packages/google-maps-routing/google/maps/routing_v2/services/routes/async_client.py +++ b/packages/google-maps-routing/google/maps/routing_v2/services/routes/async_client.py @@ -47,7 +47,12 @@ from google.protobuf import duration_pb2 # type: ignore from google.rpc import status_pb2 # type: ignore -from google.maps.routing_v2.types import fallback_info, route, routes_service +from google.maps.routing_v2.types import ( + fallback_info, + geocoding_results, + route, + routes_service, +) from .client import RoutesClient from .transports.base import DEFAULT_CLIENT_INFO, RoutesTransport diff --git a/packages/google-maps-routing/google/maps/routing_v2/services/routes/client.py b/packages/google-maps-routing/google/maps/routing_v2/services/routes/client.py index 4d19e6dd5365..8d4a09c031e3 100644 --- a/packages/google-maps-routing/google/maps/routing_v2/services/routes/client.py +++ b/packages/google-maps-routing/google/maps/routing_v2/services/routes/client.py @@ -50,7 +50,12 @@ from google.protobuf import duration_pb2 # type: ignore from google.rpc import status_pb2 # type: ignore -from google.maps.routing_v2.types import fallback_info, route, routes_service +from google.maps.routing_v2.types import ( + fallback_info, + geocoding_results, + route, + routes_service, +) from .transports.base import DEFAULT_CLIENT_INFO, RoutesTransport from .transports.grpc import RoutesGrpcTransport diff --git a/packages/google-maps-routing/google/maps/routing_v2/types/__init__.py b/packages/google-maps-routing/google/maps/routing_v2/types/__init__.py index 9efaa71283c5..0fc81931dc68 100644 --- a/packages/google-maps-routing/google/maps/routing_v2/types/__init__.py +++ b/packages/google-maps-routing/google/maps/routing_v2/types/__init__.py @@ -14,6 +14,7 @@ # limitations under the License. # from .fallback_info import FallbackInfo, FallbackReason, FallbackRoutingMode +from .geocoding_results import GeocodedWaypoint, GeocodingResults from .location import Location from .navigation_instruction import NavigationInstruction from .polyline import Polyline, PolylineEncoding, PolylineQuality @@ -44,6 +45,8 @@ "FallbackInfo", "FallbackReason", "FallbackRoutingMode", + "GeocodedWaypoint", + "GeocodingResults", "Location", "Maneuver", "NavigationInstruction", diff --git a/packages/google-maps-routing/google/maps/routing_v2/types/fallback_info.py b/packages/google-maps-routing/google/maps/routing_v2/types/fallback_info.py index 057086111010..428909da9cff 100644 --- a/packages/google-maps-routing/google/maps/routing_v2/types/fallback_info.py +++ b/packages/google-maps-routing/google/maps/routing_v2/types/fallback_info.py @@ -58,11 +58,13 @@ class FallbackRoutingMode(proto.Enum): FALLBACK_ROUTING_MODE_UNSPECIFIED (0): Not used. FALLBACK_TRAFFIC_UNAWARE (1): - Indicates the "TRAFFIC_UNAWARE" routing mode was used to + Indicates the ``TRAFFIC_UNAWARE`` + [google.maps.routing.v2.RoutingPreference] was used to compute the response. FALLBACK_TRAFFIC_AWARE (2): - Indicates the "TRAFFIC_AWARE" routing mode was used to - compute the response. + Indicates the ``TRAFFIC_AWARE`` + [RoutingPreference][google.maps.routing.v2.RoutingPreference] + was used to compute the response. """ FALLBACK_ROUTING_MODE_UNSPECIFIED = 0 FALLBACK_TRAFFIC_UNAWARE = 1 diff --git a/packages/google-maps-routing/google/maps/routing_v2/types/geocoding_results.py b/packages/google-maps-routing/google/maps/routing_v2/types/geocoding_results.py new file mode 100644 index 000000000000..3aadb7121661 --- /dev/null +++ b/packages/google-maps-routing/google/maps/routing_v2/types/geocoding_results.py @@ -0,0 +1,125 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +from __future__ import annotations + +from typing import MutableMapping, MutableSequence + +from google.rpc import status_pb2 # type: ignore +import proto # type: ignore + +__protobuf__ = proto.module( + package="google.maps.routing.v2", + manifest={ + "GeocodingResults", + "GeocodedWaypoint", + }, +) + + +class GeocodingResults(proto.Message): + r"""Contains + [GeocodedWaypoints][google.maps.routing.v2.GeocodedWaypoint] for + origin, destination and intermediate waypoints. Only populated for + address waypoints. + + Attributes: + origin (google.maps.routing_v2.types.GeocodedWaypoint): + Origin geocoded waypoint. + destination (google.maps.routing_v2.types.GeocodedWaypoint): + Destination geocoded waypoint. + intermediates (MutableSequence[google.maps.routing_v2.types.GeocodedWaypoint]): + A list of intermediate geocoded waypoints + each containing an index field that corresponds + to the zero-based position of the waypoint in + the order they were specified in the request. + """ + + origin: "GeocodedWaypoint" = proto.Field( + proto.MESSAGE, + number=1, + message="GeocodedWaypoint", + ) + destination: "GeocodedWaypoint" = proto.Field( + proto.MESSAGE, + number=2, + message="GeocodedWaypoint", + ) + intermediates: MutableSequence["GeocodedWaypoint"] = proto.RepeatedField( + proto.MESSAGE, + number=3, + message="GeocodedWaypoint", + ) + + +class GeocodedWaypoint(proto.Message): + r"""Details about the locations used as waypoints. Only populated + for address waypoints. Includes details about the geocoding + results for the purposes of determining what the address was + geocoded to. + + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + geocoder_status (google.rpc.status_pb2.Status): + Indicates the status code resulting from the + geocoding operation. + intermediate_waypoint_request_index (int): + The index of the corresponding intermediate + waypoint in the request. Only populated if the + corresponding waypoint is an intermediate + waypoint. + + This field is a member of `oneof`_ ``_intermediate_waypoint_request_index``. + type_ (MutableSequence[str]): + The type(s) of the result, in the form of + zero or more type tags. Supported types: + https://developers.google.com/maps/documentation/geocoding/requests-geocoding#Types + partial_match (bool): + Indicates that the geocoder did not return an + exact match for the original request, though it + was able to match part of the requested address. + You may wish to examine the original request for + misspellings and/or an incomplete address. + place_id (str): + The place ID for this result. + """ + + geocoder_status: status_pb2.Status = proto.Field( + proto.MESSAGE, + number=1, + message=status_pb2.Status, + ) + intermediate_waypoint_request_index: int = proto.Field( + proto.INT32, + number=2, + optional=True, + ) + type_: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=3, + ) + partial_match: bool = proto.Field( + proto.BOOL, + number=4, + ) + place_id: str = proto.Field( + proto.STRING, + number=5, + ) + + +__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/packages/google-maps-routing/google/maps/routing_v2/types/location.py b/packages/google-maps-routing/google/maps/routing_v2/types/location.py index 66cd5246a744..f3803ba2507f 100644 --- a/packages/google-maps-routing/google/maps/routing_v2/types/location.py +++ b/packages/google-maps-routing/google/maps/routing_v2/types/location.py @@ -42,7 +42,8 @@ class Location(proto.Message): the road to use for pickup and drop-off. Heading values can be from 0 to 360, where 0 specifies a heading of due North, 90 specifies a heading of due East, etc. You can use this - field only for ``DRIVE`` and ``TWO_WHEELER`` travel modes. + field only for ``DRIVE`` and ``TWO_WHEELER`` + [RouteTravelMode][google.maps.routing.v2.RouteTravelMode]. """ lat_lng: latlng_pb2.LatLng = proto.Field( 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 be3622847d42..c1272b02a875 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 @@ -17,7 +17,7 @@ from typing import MutableMapping, MutableSequence -import google.geo.type.types +from google.geo.type.types import viewport as ggt_viewport from google.protobuf import duration_pb2 # type: ignore import proto # type: ignore @@ -54,10 +54,11 @@ class Route(proto.Message): legs (MutableSequence[google.maps.routing_v2.types.RouteLeg]): A collection of legs (path segments between waypoints) that make-up the route. Each leg corresponds to the trip between - two non-\ ``via`` Waypoints. For example, a route with no - intermediate waypoints has only one leg. A route that - includes one non-\ ``via`` intermediate waypoint has two - legs. A route that includes one ``via`` intermediate + two non-\ ``via`` + [Waypoints][google.maps.routing.v2.Waypoint]. For example, a + route with no intermediate waypoints has only one leg. A + route that includes one non-\ ``via`` intermediate waypoint + has two legs. A route that includes one ``via`` intermediate waypoint has one leg. The order of the legs matches the order of Waypoints from ``origin`` to ``intermediates`` to ``destination``. @@ -137,10 +138,10 @@ class Route(proto.Message): proto.STRING, number=7, ) - viewport: google.geo.type.types.Viewport = proto.Field( + viewport: ggt_viewport.Viewport = proto.Field( proto.MESSAGE, number=8, - message=google.geo.type.types.Viewport, + message=ggt_viewport.Viewport, ) travel_advisory: "RouteTravelAdvisory" = proto.Field( proto.MESSAGE, @@ -254,19 +255,7 @@ class RouteLegStepTravelAdvisory(proto.Message): Attributes: speed_reading_intervals (MutableSequence[google.maps.routing_v2.types.SpeedReadingInterval]): - Speed reading intervals detailing traffic density. - Applicable in case of ``TRAFFIC_AWARE`` and - ``TRAFFIC_AWARE_OPTIMAL`` routing preferences. The intervals - cover the entire polyline of the RouteLegStep without - overlap. The start point of a specified interval is the same - as the end point of the preceding interval. - - Example: - - :: - - polyline: A ---- B ---- C ---- D ---- E ---- F ---- G - speed_reading_intervals: [A,C), [C,D), [D,G). + NOTE: This field is not currently populated. """ speed_reading_intervals: MutableSequence[ @@ -361,7 +350,8 @@ class RouteLeg(proto.Message): class RouteLegStep(proto.Message): - r"""Encapsulates a segment of a ``RouteLeg``. A step corresponds to a + r"""Encapsulates a segment of a + [RouteLeg][google.maps.routing.v2.RouteLeg]. A step corresponds to a single navigation instruction. Route legs are made up of steps. Attributes: 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 2ad524de7d31..21f0b175bd31 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 @@ -28,8 +28,9 @@ class RouteLabel(proto.Enum): - r"""Labels for the ``Route`` that are useful to identify specific - properties of the route to compare against others. + r"""Labels for the [Route][google.maps.routing.v2.Route] that are useful + to identify specific properties of the route to compare against + others. Values: ROUTE_LABEL_UNSPECIFIED (0): @@ -40,8 +41,8 @@ class RouteLabel(proto.Enum): DEFAULT_ROUTE_ALTERNATE (2): An alternative to the default "best" route. Routes like this will be returned when - ``ComputeRoutesRequest.compute_alternative_routes`` is - specified. + [compute_alternative_routes][google.maps.routing.v2.ComputeRoutesRequest.compute_alternative_routes] + is specified. FUEL_EFFICIENT (3): Fuel efficient route. Routes labeled with this value are determined to be optimized for diff --git a/packages/google-maps-routing/google/maps/routing_v2/types/route_modifiers.py b/packages/google-maps-routing/google/maps/routing_v2/types/route_modifiers.py index a850f89669ef..8d3c62be2560 100644 --- a/packages/google-maps-routing/google/maps/routing_v2/types/route_modifiers.py +++ b/packages/google-maps-routing/google/maps/routing_v2/types/route_modifiers.py @@ -39,22 +39,22 @@ class RouteModifiers(proto.Message): Specifies whether to avoid toll roads where reasonable. Preference will be given to routes not containing toll roads. Applies only to the ``DRIVE`` and ``TWO_WHEELER`` - travel modes. + [RouteTravelMode][google.maps.routing.v2.RouteTravelMode]. avoid_highways (bool): Specifies whether to avoid highways where reasonable. Preference will be given to routes not containing highways. - Applies only to the ``DRIVE`` and ``TWO_WHEELER`` travel - modes. + Applies only to the ``DRIVE`` and ``TWO_WHEELER`` + [RouteTravelMode][google.maps.routing.v2.RouteTravelMode]. avoid_ferries (bool): Specifies whether to avoid ferries where reasonable. Preference will be given to routes not containing travel by ferries. Applies only to the ``DRIVE`` and\ ``TWO_WHEELER`` - travel modes. + [RouteTravelMode][google.maps.routing.v2.RouteTravelMode]. avoid_indoor (bool): Specifies whether to avoid navigating indoors where reasonable. Preference will be given to routes not containing indoor navigation. Applies only to the ``WALK`` - travel mode. + [RouteTravelMode][google.maps.routing.v2.RouteTravelMode]. vehicle_info (google.maps.routing_v2.types.VehicleInfo): Specifies the vehicle information. toll_passes (MutableSequence[google.maps.routing_v2.types.TollPass]): @@ -62,7 +62,8 @@ class RouteModifiers(proto.Message): are provided, the API tries to return the pass price. If toll passes are not provided, the API treats the toll pass as unknown and tries to return the cash price. Applies only - to the DRIVE and TWO_WHEELER travel modes. + to the ``DRIVE`` and ``TWO_WHEELER`` + [RouteTravelMode][google.maps.routing.v2.RouteTravelMode]. """ avoid_tolls: bool = proto.Field( diff --git a/packages/google-maps-routing/google/maps/routing_v2/types/route_travel_mode.py b/packages/google-maps-routing/google/maps/routing_v2/types/route_travel_mode.py index 7a5337a311f6..9a4109a9e795 100644 --- a/packages/google-maps-routing/google/maps/routing_v2/types/route_travel_mode.py +++ b/packages/google-maps-routing/google/maps/routing_v2/types/route_travel_mode.py @@ -28,11 +28,11 @@ class RouteTravelMode(proto.Enum): - r"""A set of values used to specify the mode of travel. NOTE: WALK, - BICYCLE, and TWO_WHEELER routes are in beta and might sometimes be - missing clear sidewalks, pedestrian paths, or bicycling paths. You - must display this warning to the user for all walking, bicycling, - and two-wheel routes that you display in your app. + r"""A set of values used to specify the mode of travel. NOTE: ``WALK``, + ``BICYCLE``, and ``TWO_WHEELER`` routes are in beta and might + sometimes be missing clear sidewalks, pedestrian paths, or bicycling + paths. You must display this warning to the user for all walking, + bicycling, and two-wheel routes that you display in your app. Values: TRAVEL_MODE_UNSPECIFIED (0): 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 d6b3374333c4..81f18bab8136 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 @@ -22,6 +22,7 @@ from google.rpc import status_pb2 # type: ignore import proto # type: ignore +from google.maps.routing_v2.types import geocoding_results as gmr_geocoding_results from google.maps.routing_v2.types import routing_preference as gmr_routing_preference from google.maps.routing_v2.types import fallback_info as gmr_fallback_info from google.maps.routing_v2.types import polyline, route @@ -100,7 +101,9 @@ class ComputeRoutesRequest(proto.Message): the request fails. compute_alternative_routes (bool): Optional. Specifies whether to calculate - alternate routes in addition to the route. + alternate routes in addition to the route. No + alternative routes are returned for requests + that have intermediate waypoints. route_modifiers (google.maps.routing_v2.types.RouteModifiers): Optional. A set of conditions to satisfy that affect the way routes are calculated. @@ -113,19 +116,24 @@ class ComputeRoutesRequest(proto.Message): for the list of supported languages. When you don't provide this value, the display language is inferred from the location of the route request. + region_code (str): + Optional. The region code, specified as a ccTLD ("top-level + domain") two-character value. For more information see + https://en.wikipedia.org/wiki/List_of_Internet_top-level_domains#Country_code_top-level_domains units (google.maps.routing_v2.types.Units): Optional. Specifies the units of measure for the display fields. This includes the ``instruction`` field in - ``NavigationInstruction``. The units of measure used for the - route, leg, step distance, and duration are not affected by - this value. If you don't provide this value, then the - display units are inferred from the location of the request. + [NavigationInstruction][google.maps.routing.v2.NavigationInstruction]. + The units of measure used for the route, leg, step distance, + and duration are not affected by this value. If you don't + provide this value, then the display units are inferred from + the location of the request. requested_reference_routes (MutableSequence[google.maps.routing_v2.types.ComputeRoutesRequest.ReferenceRoute]): Optional. Specifies what reference routes to calculate as part of the request in addition to the default route. A reference route is a route with a different route - calculation objective than the default route. For example an - FUEL_EFFICIENT reference route calculation takes into + 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. extra_computations (MutableSequence[google.maps.routing_v2.types.ComputeRoutesRequest.ExtraComputation]): @@ -224,6 +232,10 @@ class ExtraComputation(proto.Enum): proto.STRING, number=10, ) + region_code: str = proto.Field( + proto.STRING, + number=16, + ) units: gmr_units.Units = proto.Field( proto.ENUM, number=11, @@ -259,6 +271,9 @@ class ComputeRoutesResponse(proto.Message): is used, this field contains detailed info about the fallback response. Otherwise this field is unset. + geocoding_results (google.maps.routing_v2.types.GeocodingResults): + Contains geocoding response info for + waypoints specified as addresses. """ routes: MutableSequence[route.Route] = proto.RepeatedField( @@ -271,6 +286,11 @@ class ComputeRoutesResponse(proto.Message): number=2, message=gmr_fallback_info.FallbackInfo, ) + geocoding_results: gmr_geocoding_results.GeocodingResults = proto.Field( + proto.MESSAGE, + number=3, + message=gmr_geocoding_results.GeocodingResults, + ) class ComputeRouteMatrixRequest(proto.Message): @@ -308,6 +328,19 @@ class ComputeRouteMatrixRequest(proto.Message): you made the request. If you set this value to a time that has already occurred, the request fails. + language_code (str): + Optional. The BCP-47 language code, such as "en-US" or + "sr-Latn". For more information, see + http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. + See `Language + Support `__ + for the list of supported languages. When you don't provide + this value, the display language is inferred from the + location of the first origin. + region_code (str): + Optional. The region code, specified as a ccTLD ("top-level + domain") two-character value. For more information see + https://en.wikipedia.org/wiki/List_of_Internet_top-level_domains#Country_code_top-level_domains extra_computations (MutableSequence[google.maps.routing_v2.types.ComputeRouteMatrixRequest.ExtraComputation]): Optional. A list of extra computations which may be used to complete the request. Note: These @@ -355,6 +388,14 @@ class ExtraComputation(proto.Enum): number=5, message=timestamp_pb2.Timestamp, ) + language_code: str = proto.Field( + proto.STRING, + number=6, + ) + region_code: str = proto.Field( + proto.STRING, + number=9, + ) extra_computations: MutableSequence[ExtraComputation] = proto.RepeatedField( proto.ENUM, number=8, @@ -428,11 +469,13 @@ class RouteMatrixElement(proto.Message): The travel distance of the route, in meters. duration (google.protobuf.duration_pb2.Duration): The length of time needed to navigate the route. If you set - the ``routing_preference`` to ``TRAFFIC_UNAWARE``, then this - value is the same as ``static_duration``. If you set the - ``routing_preference`` to either ``TRAFFIC_AWARE`` or - ``TRAFFIC_AWARE_OPTIMAL``, then this value is calculated - taking traffic conditions into account. + the + [routing_preference][google.maps.routing.v2.ComputeRouteMatrixRequest.routing_preference] + to ``TRAFFIC_UNAWARE``, then this value is the same as + ``static_duration``. If you set the ``routing_preference`` + to either ``TRAFFIC_AWARE`` or ``TRAFFIC_AWARE_OPTIMAL``, + then this value is calculated taking traffic conditions into + account. static_duration (google.protobuf.duration_pb2.Duration): The duration of traveling through the route without taking traffic conditions into diff --git a/packages/google-maps-routing/google/maps/routing_v2/types/routing_preference.py b/packages/google-maps-routing/google/maps/routing_v2/types/routing_preference.py index f93bdcda32c0..26fb06d13c32 100644 --- a/packages/google-maps-routing/google/maps/routing_v2/types/routing_preference.py +++ b/packages/google-maps-routing/google/maps/routing_v2/types/routing_preference.py @@ -39,13 +39,15 @@ class RoutingPreference(proto.Enum): Computes routes without taking live traffic conditions into consideration. Suitable when traffic conditions don't matter or are not applicable. Using this value produces the lowest - latency. Note: For ``RouteTravelMode`` DRIVE and TWO_WHEELER - choice of route and duration are based on road network and - average time-independent traffic conditions. Results for a - given request may vary over time due to changes in the road - network, updated average traffic conditions, and the - distributed nature of the service. Results may also vary - between nearly-equivalent routes at any time or frequency. + latency. Note: For + [RouteTravelMode][google.maps.routing.v2.RouteTravelMode] + ``DRIVE`` and ``TWO_WHEELER`` choice of route and duration + are based on road network and average time-independent + traffic conditions. Results for a given request may vary + over time due to changes in the road network, updated + average traffic conditions, and the distributed nature of + the service. Results may also vary between nearly-equivalent + routes at any time or frequency. TRAFFIC_AWARE (2): Calculates routes taking live traffic conditions into consideration. In contrast to ``TRAFFIC_AWARE_OPTIMAL``, diff --git a/packages/google-maps-routing/google/maps/routing_v2/types/speed_reading_interval.py b/packages/google-maps-routing/google/maps/routing_v2/types/speed_reading_interval.py index ffd0f8a21a62..238811a3522f 100644 --- a/packages/google-maps-routing/google/maps/routing_v2/types/speed_reading_interval.py +++ b/packages/google-maps-routing/google/maps/routing_v2/types/speed_reading_interval.py @@ -49,6 +49,8 @@ class SpeedReadingInterval(proto.Message): This field is a member of `oneof`_ ``_end_polyline_point_index``. speed (google.maps.routing_v2.types.SpeedReadingInterval.Speed): Traffic speed in this interval. + + This field is a member of `oneof`_ ``speed_type``. """ class Speed(proto.Enum): @@ -82,6 +84,7 @@ class Speed(proto.Enum): speed: Speed = proto.Field( proto.ENUM, number=3, + oneof="speed_type", enum=Speed, ) diff --git a/packages/google-maps-routing/google/maps/routing_v2/types/toll_info.py b/packages/google-maps-routing/google/maps/routing_v2/types/toll_info.py index 87048e6140b2..901f8ea51f8a 100644 --- a/packages/google-maps-routing/google/maps/routing_v2/types/toll_info.py +++ b/packages/google-maps-routing/google/maps/routing_v2/types/toll_info.py @@ -29,19 +29,20 @@ class TollInfo(proto.Message): - r"""Encapsulates toll information on a ``Route`` or on a ``RouteLeg``. + r"""Encapsulates toll information on a + [Route][google.maps.routing.v2.Route] or on a + [RouteLeg][google.maps.routing.v2.RouteLeg]. Attributes: estimated_price (MutableSequence[google.type.money_pb2.Money]): - The monetary amount of tolls for the - corresponding Route or RouteLeg. This list - contains a money amount for each currency that - is expected to be charged by the toll stations. - Typically this list will contain only one item - for routes with tolls in one currency. For - international trips, this list may contain - multiple items to reflect tolls in different - currencies. + The monetary amount of tolls for the corresponding + [Route][google.maps.routing.v2.Route] or + [RouteLeg][google.maps.routing.v2.RouteLeg]. This list + contains a money amount for each currency that is expected + to be charged by the toll stations. Typically this list will + contain only one item for routes with tolls in one currency. + For international trips, this list may contain multiple + items to reflect tolls in different currencies. """ estimated_price: MutableSequence[money_pb2.Money] = proto.RepeatedField( diff --git a/packages/google-maps-routing/google/maps/routing_v2/types/toll_passes.py b/packages/google-maps-routing/google/maps/routing_v2/types/toll_passes.py index 4832e675cd62..6ca198eb924c 100644 --- a/packages/google-maps-routing/google/maps/routing_v2/types/toll_passes.py +++ b/packages/google-maps-routing/google/maps/routing_v2/types/toll_passes.py @@ -177,6 +177,8 @@ class TollPass(proto.Enum): ME, USA. US_MI_AMBASSADOR_BRIDGE_PREMIER_COMMUTER_CARD (36): MI, USA. + US_MI_BCPASS (94): + MI, USA. US_MI_GROSSE_ILE_TOLL_BRIDGE_PASS_TAG (37): MI, USA. US_MI_IQ_PROX_CARD (38): @@ -306,6 +308,7 @@ class TollPass(proto.Enum): US_MD_EZPASSMD = 34 US_ME_EZPASSME = 35 US_MI_AMBASSADOR_BRIDGE_PREMIER_COMMUTER_CARD = 36 + US_MI_BCPASS = 94 US_MI_GROSSE_ILE_TOLL_BRIDGE_PASS_TAG = 37 US_MI_IQ_PROX_CARD = 38 US_MI_MACKINAC_BRIDGE_MAC_PASS = 39 diff --git a/packages/google-maps-routing/google/maps/routing_v2/types/vehicle_emission_type.py b/packages/google-maps-routing/google/maps/routing_v2/types/vehicle_emission_type.py index 442c8524a860..0df563e53a46 100644 --- a/packages/google-maps-routing/google/maps/routing_v2/types/vehicle_emission_type.py +++ b/packages/google-maps-routing/google/maps/routing_v2/types/vehicle_emission_type.py @@ -28,13 +28,13 @@ class VehicleEmissionType(proto.Enum): - r"""A set of values describing the vehicle's emission type. - Applies only to the DRIVE travel mode. + r"""A set of values describing the vehicle's emission type. Applies only + to the ``DRIVE`` + [RouteTravelMode][google.maps.routing.v2.RouteTravelMode]. Values: VEHICLE_EMISSION_TYPE_UNSPECIFIED (0): - No emission type specified. Default to - GASOLINE. + No emission type specified. Default to ``GASOLINE``. GASOLINE (1): Gasoline/petrol fueled vehicle. ELECTRIC (2): diff --git a/packages/google-maps-routing/google/maps/routing_v2/types/vehicle_info.py b/packages/google-maps-routing/google/maps/routing_v2/types/vehicle_info.py index da1f14271dca..4005a547d2eb 100644 --- a/packages/google-maps-routing/google/maps/routing_v2/types/vehicle_info.py +++ b/packages/google-maps-routing/google/maps/routing_v2/types/vehicle_info.py @@ -35,8 +35,8 @@ class VehicleInfo(proto.Message): Attributes: emission_type (google.maps.routing_v2.types.VehicleEmissionType): - Describes the vehicle's emission type. - Applies only to the DRIVE travel mode. + Describes the vehicle's emission type. Applies only to the + ``DRIVE`` travel mode. """ emission_type: vehicle_emission_type.VehicleEmissionType = proto.Field( diff --git a/packages/google-maps-routing/google/maps/routing_v2/types/waypoint.py b/packages/google-maps-routing/google/maps/routing_v2/types/waypoint.py index a768b3fe1cde..0b9160d1c2e0 100644 --- a/packages/google-maps-routing/google/maps/routing_v2/types/waypoint.py +++ b/packages/google-maps-routing/google/maps/routing_v2/types/waypoint.py @@ -51,12 +51,18 @@ class Waypoint(proto.Message): The POI Place ID associated with the waypoint. + This field is a member of `oneof`_ ``location_type``. + address (str): + Human readable address or a plus code. + See https://plus.codes for details. + This field is a member of `oneof`_ ``location_type``. via (bool): Marks this waypoint as a milestone rather a stopping point. For each non-via waypoint in the request, the response - appends an entry to the ``legs`` array to provide the - details for stopovers on that leg of the trip. Set this + appends an entry to the + [legs][google.maps.routing.v2.Route.legs] array to provide + the details for stopovers on that leg of the trip. Set this value to true when you want the route to pass through this waypoint without stopping over. Via waypoints don't cause an entry to be added to the ``legs`` array, but they do route @@ -73,7 +79,8 @@ class Waypoint(proto.Message): non-\ ``via`` waypoints on roads that are unsuitable for pickup and drop-off. This option works only for ``DRIVE`` and ``TWO_WHEELER`` travel modes, and when the - ``location_type`` is ``location``. + ``location_type`` is + [Location][google.maps.routing.v2.Location]. side_of_road (bool): Indicates that the location of this waypoint is meant to have a preference for the vehicle to stop at a particular @@ -81,7 +88,8 @@ class Waypoint(proto.Message): through the location so that the vehicle can stop at the side of road that the location is biased towards from the center of the road. This option works only for 'DRIVE' and - 'TWO_WHEELER' travel modes. + 'TWO_WHEELER' + [RouteTravelMode][google.maps.routing.v2.RouteTravelMode]. """ location: gmr_location.Location = proto.Field( @@ -95,6 +103,11 @@ class Waypoint(proto.Message): number=2, oneof="location_type", ) + address: str = proto.Field( + proto.STRING, + number=7, + oneof="location_type", + ) via: bool = proto.Field( proto.BOOL, number=3, diff --git a/packages/google-maps-routing/scripts/fixup_routing_v2_keywords.py b/packages/google-maps-routing/scripts/fixup_routing_v2_keywords.py index 291c4ea93db5..ab8c9f6352a2 100644 --- a/packages/google-maps-routing/scripts/fixup_routing_v2_keywords.py +++ b/packages/google-maps-routing/scripts/fixup_routing_v2_keywords.py @@ -39,8 +39,8 @@ def partition( class routingCallTransformer(cst.CSTTransformer): CTRL_PARAMS: Tuple[str] = ('retry', 'timeout', 'metadata') METHOD_TO_PARAMS: Dict[str, Tuple[str]] = { - 'compute_route_matrix': ('origins', 'destinations', 'travel_mode', 'routing_preference', 'departure_time', 'extra_computations', ), - 'compute_routes': ('origin', 'destination', 'intermediates', 'travel_mode', 'routing_preference', 'polyline_quality', 'polyline_encoding', 'departure_time', 'compute_alternative_routes', 'route_modifiers', 'language_code', 'units', 'requested_reference_routes', 'extra_computations', ), + 'compute_route_matrix': ('origins', 'destinations', 'travel_mode', 'routing_preference', 'departure_time', 'language_code', 'region_code', 'extra_computations', ), + 'compute_routes': ('origin', 'destination', 'intermediates', 'travel_mode', 'routing_preference', 'polyline_quality', 'polyline_encoding', 'departure_time', 'compute_alternative_routes', 'route_modifiers', 'language_code', 'region_code', 'units', 'requested_reference_routes', 'extra_computations', ), } def leave_Call(self, original: cst.Call, updated: cst.Call) -> cst.CSTNode: diff --git a/packages/google-maps-routing/setup.py b/packages/google-maps-routing/setup.py index 9baa2a95020c..80774eef6672 100644 --- a/packages/google-maps-routing/setup.py +++ b/packages/google-maps-routing/setup.py @@ -40,7 +40,7 @@ "proto-plus >= 1.22.0, <2.0.0dev", "proto-plus >= 1.22.2, <2.0.0dev; python_version>='3.11'", "protobuf>=3.19.5,<5.0.0dev,!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5", - "google-geo-type<1.0.0dev", + "google-geo-type >= 0.1.0, <1.0.0dev", ] url = "https://github.com/googleapis/google-cloud-python" diff --git a/packages/google-maps-routing/testing/constraints-3.10.txt b/packages/google-maps-routing/testing/constraints-3.10.txt index ed7f9aed2559..2214a366a259 100644 --- a/packages/google-maps-routing/testing/constraints-3.10.txt +++ b/packages/google-maps-routing/testing/constraints-3.10.txt @@ -4,3 +4,4 @@ google-api-core proto-plus protobuf +google-geo-type diff --git a/packages/google-maps-routing/testing/constraints-3.11.txt b/packages/google-maps-routing/testing/constraints-3.11.txt index ed7f9aed2559..2214a366a259 100644 --- a/packages/google-maps-routing/testing/constraints-3.11.txt +++ b/packages/google-maps-routing/testing/constraints-3.11.txt @@ -4,3 +4,4 @@ google-api-core proto-plus protobuf +google-geo-type diff --git a/packages/google-maps-routing/testing/constraints-3.12.txt b/packages/google-maps-routing/testing/constraints-3.12.txt index ed7f9aed2559..2214a366a259 100644 --- a/packages/google-maps-routing/testing/constraints-3.12.txt +++ b/packages/google-maps-routing/testing/constraints-3.12.txt @@ -4,3 +4,4 @@ google-api-core proto-plus protobuf +google-geo-type diff --git a/packages/google-maps-routing/testing/constraints-3.8.txt b/packages/google-maps-routing/testing/constraints-3.8.txt index ed7f9aed2559..2214a366a259 100644 --- a/packages/google-maps-routing/testing/constraints-3.8.txt +++ b/packages/google-maps-routing/testing/constraints-3.8.txt @@ -4,3 +4,4 @@ google-api-core proto-plus protobuf +google-geo-type diff --git a/packages/google-maps-routing/testing/constraints-3.9.txt b/packages/google-maps-routing/testing/constraints-3.9.txt index ed7f9aed2559..2214a366a259 100644 --- a/packages/google-maps-routing/testing/constraints-3.9.txt +++ b/packages/google-maps-routing/testing/constraints-3.9.txt @@ -4,3 +4,4 @@ google-api-core proto-plus protobuf +google-geo-type diff --git a/packages/google-maps-routing/tests/unit/gapic/routing_v2/test_routes.py b/packages/google-maps-routing/tests/unit/gapic/routing_v2/test_routes.py index d55a16fe2d67..068ec592948f 100644 --- a/packages/google-maps-routing/tests/unit/gapic/routing_v2/test_routes.py +++ b/packages/google-maps-routing/tests/unit/gapic/routing_v2/test_routes.py @@ -54,6 +54,7 @@ ) from google.maps.routing_v2.types import ( fallback_info, + geocoding_results, location, polyline, route,