Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -68,6 +72,8 @@
"FallbackInfo",
"FallbackReason",
"FallbackRoutingMode",
"GeocodedWaypoint",
"GeocodingResults",
"Location",
"Maneuver",
"NavigationInstruction",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -61,6 +62,8 @@
"FallbackInfo",
"FallbackReason",
"FallbackRoutingMode",
"GeocodedWaypoint",
"GeocodingResults",
"Location",
"Maneuver",
"NavigationInstruction",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -44,6 +45,8 @@
"FallbackInfo",
"FallbackReason",
"FallbackRoutingMode",
"GeocodedWaypoint",
"GeocodingResults",
"Location",
"Maneuver",
"NavigationInstruction",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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))
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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``.
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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[
Expand Down Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,30 +39,31 @@ 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]):
Encapsulates information about toll passes. If toll passes
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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
Loading