Skip to content

Commit 104d44d

Browse files
feat: [google-maps-routing] add API for shorter distance reference routes (#13306)
- [ ] Regenerate this pull request now. PiperOrigin-RevId: 700387857 Source-Link: googleapis/googleapis@4deb95d Source-Link: googleapis/googleapis-gen@a38a16c Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLW1hcHMtcm91dGluZy8uT3dsQm90LnlhbWwiLCJoIjoiYTM4YTE2YzQzYzY4NjgxYmJmNWMwZGU3OTE0YjcyNzkwYTRiNmIyYiJ9 --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent b84e0a9 commit 104d44d

File tree

6 files changed

+49
-23
lines changed

6 files changed

+49
-23
lines changed

packages/google-maps-routing/google/maps/routing/gapic_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "0.6.12" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-maps-routing/google/maps/routing_v2/gapic_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "0.6.12" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-maps-routing/google/maps/routing_v2/types/route.py

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -110,15 +110,16 @@ class Route(proto.Message):
110110
localized_values (google.maps.routing_v2.types.Route.RouteLocalizedValues):
111111
Text representations of properties of the ``Route``.
112112
route_token (str):
113-
A web-safe, base64-encoded route token that can be passed to
114-
the Navigation SDK, that allows the Navigation SDK to
115-
reconstruct the route during navigation, and, in the event
116-
of rerouting, honor the original intention when you created
117-
the route by calling ComputeRoutes. Customers should treat
118-
this token as an opaque blob. It is not meant for reading or
119-
mutating. NOTE: ``Route.route_token`` is only available for
120-
requests that have set
121-
``ComputeRoutesRequest.routing_preference`` to
113+
An opaque token that can be passed to `Navigation
114+
SDK <https://developers.google.com/maps/documentation/navigation>`__
115+
to reconstruct the route during navigation, and, in the
116+
event of rerouting, honor the original intention when the
117+
route was created. Treat this token as an opaque blob. Don't
118+
compare its value across requests as its value may change
119+
even if the service returns the exact same route.
120+
121+
NOTE: ``Route.route_token`` is only available for requests
122+
that have set ``ComputeRoutesRequest.routing_preference`` to
122123
``TRAFFIC_AWARE`` or ``TRAFFIC_AWARE_OPTIMAL``.
123124
``Route.route_token`` is not supported for requests that
124125
have Via waypoints.
@@ -131,9 +132,10 @@ class RouteLocalizedValues(proto.Message):
131132
distance (google.type.localized_text_pb2.LocalizedText):
132133
Travel distance represented in text form.
133134
duration (google.type.localized_text_pb2.LocalizedText):
134-
Duration taking traffic conditions into consideration,
135-
represented in text form. Note: If you did not request
136-
traffic information, this value will be the same value as
135+
Duration, represented in text form and localized to the
136+
region of the query. Takes traffic conditions into
137+
consideration. Note: If you did not request traffic
138+
information, this value is the same value as
137139
``static_duration``.
138140
static_duration (google.type.localized_text_pb2.LocalizedText):
139141
Duration without taking traffic conditions
@@ -408,9 +410,10 @@ class RouteLegLocalizedValues(proto.Message):
408410
distance (google.type.localized_text_pb2.LocalizedText):
409411
Travel distance represented in text form.
410412
duration (google.type.localized_text_pb2.LocalizedText):
411-
Duration taking traffic conditions into consideration
412-
represented in text form. Note: If you did not request
413-
traffic information, this value will be the same value as
413+
Duration, represented in text form and localized to the
414+
region of the query. Takes traffic conditions into
415+
consideration. Note: If you did not request traffic
416+
information, this value is the same value as
414417
static_duration.
415418
static_duration (google.type.localized_text_pb2.LocalizedText):
416419
Duration without taking traffic conditions
@@ -695,7 +698,7 @@ class RouteLegStepTransitDetails(proto.Message):
695698
This count includes the arrival stop, but excludes the
696699
departure stop. For example, if your route leaves from Stop
697700
A, passes through stops B and C, and arrives at stop D,
698-
stop_count will return 3.
701+
stop_count returns 3.
699702
trip_short_text (str):
700703
The text that appears in schedules and sign boards to
701704
identify a transit trip to passengers. The text should

packages/google-maps-routing/google/maps/routing_v2/types/route_label.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,15 @@ class RouteLabel(proto.Enum):
4747
Fuel efficient route. Routes labeled with
4848
this value are determined to be optimized for
4949
Eco parameters such as fuel consumption.
50+
SHORTER_DISTANCE (4):
51+
Shorter travel distance route. This is an
52+
experimental feature.
5053
"""
5154
ROUTE_LABEL_UNSPECIFIED = 0
5255
DEFAULT_ROUTE = 1
5356
DEFAULT_ROUTE_ALTERNATE = 2
5457
FUEL_EFFICIENT = 3
58+
SHORTER_DISTANCE = 4
5559

5660

5761
__all__ = tuple(sorted(__protobuf__.manifest))

packages/google-maps-routing/google/maps/routing_v2/types/routes_service.py

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,9 @@ class ComputeRoutesRequest(proto.Message):
161161
calculation objective than the default route. For example a
162162
``FUEL_EFFICIENT`` reference route calculation takes into
163163
account various parameters that would generate an optimal
164-
fuel efficient route.
164+
fuel efficient route. When using this feature, look for
165+
[``route_labels``][google.maps.routing.v2.Route.route_labels]
166+
on the resulting routes.
165167
extra_computations (MutableSequence[google.maps.routing_v2.types.ComputeRoutesRequest.ExtraComputation]):
166168
Optional. A list of extra computations which
167169
may be used to complete the request. Note: These
@@ -199,12 +201,29 @@ class ReferenceRoute(proto.Enum):
199201
Not used. Requests containing this value
200202
fail.
201203
FUEL_EFFICIENT (1):
202-
Fuel efficient route. Routes labeled with
203-
this value are determined to be optimized for
204-
parameters such as fuel consumption.
204+
Fuel efficient route.
205+
SHORTER_DISTANCE (2):
206+
Route with shorter travel distance. This is an experimental
207+
feature.
208+
209+
For ``DRIVE`` requests, this feature prioritizes shorter
210+
distance over driving comfort. For example, it may prefer
211+
local roads instead of highways, take dirt roads, cut
212+
through parking lots, etc. This feature does not return any
213+
maneuvers that Google Maps knows to be illegal.
214+
215+
For ``BICYCLE`` and ``TWO_WHEELER`` requests, this feature
216+
returns routes similar to those returned when you don't
217+
specify ``requested_reference_routes``.
218+
219+
This feature is not compatible with any other travel modes,
220+
via intermediate waypoints, or ``optimize_waypoint_order``;
221+
such requests will fail. However, you can use it with any
222+
``routing_preference``.
205223
"""
206224
REFERENCE_ROUTE_UNSPECIFIED = 0
207225
FUEL_EFFICIENT = 1
226+
SHORTER_DISTANCE = 2
208227

209228
class ExtraComputation(proto.Enum):
210229
r"""Extra computations to perform while completing the request.

packages/google-maps-routing/samples/generated_samples/snippet_metadata_google.maps.routing.v2.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
],
99
"language": "PYTHON",
1010
"name": "google-maps-routing",
11-
"version": "0.6.12"
11+
"version": "0.1.0"
1212
},
1313
"snippets": [
1414
{

0 commit comments

Comments
 (0)