xref: /aosp_15_r20/external/googleapis/google/maps/routes/v1/route.proto (revision d5c09012810ac0c9f33fe448fb6da8260d444cc9)
1// Copyright 2022 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
15syntax = "proto3";
16
17package google.maps.routes.v1;
18
19import "google/geo/type/viewport.proto";
20import "google/maps/routes/v1/polyline.proto";
21import "google/maps/routes/v1/waypoint.proto";
22import "google/protobuf/duration.proto";
23import "google/type/money.proto";
24
25option cc_enable_arenas = true;
26option csharp_namespace = "Google.Maps.Routes.V1";
27option go_package = "cloud.google.com/go/maps/routes/apiv1/routespb;routespb";
28option java_multiple_files = true;
29option java_outer_classname = "RouteProto";
30option java_package = "com.google.maps.routes.v1";
31option objc_class_prefix = "GMRS";
32option php_namespace = "Google\\Maps\\Routes\\V1";
33
34// Encapsulates a route, which consists of a series of connected road segments
35// that join beginning, ending, and intermediate waypoints.
36message Route {
37  // A collection of legs (path segments between waypoints) that make-up the
38  // route. Each leg corresponds to the trip between two non-`via` Waypoints.
39  // For example, a route with no intermediate waypoints has only one leg. A
40  // route that includes one non-`via` intermediate waypoint has two legs. A
41  // route that includes one `via` intermediate waypoint has one leg. The order
42  // of the legs matches the order of Waypoints from `origin` to `intermediates`
43  // to `destination`.
44  repeated RouteLeg legs = 1;
45
46  // The travel distance of the route, in meters.
47  int32 distance_meters = 2;
48
49  // The length of time needed to navigate the route. If you set the
50  // `routing_preference` to `TRAFFIC_UNAWARE`, then this value is the same as
51  // `static_duration`. If you set the `routing_preference` to either
52  // `TRAFFIC_AWARE` or `TRAFFIC_AWARE_OPTIMAL`, then this value is calculated
53  // taking traffic conditions into account.
54  google.protobuf.Duration duration = 3;
55
56  // The duration of traveling through the route without taking traffic
57  // conditions into consideration.
58  google.protobuf.Duration static_duration = 4;
59
60  // The overall route polyline. This polyline will be the combined polyline of
61  // all `legs`.
62  Polyline polyline = 5;
63
64  // A description of the route.
65  string description = 6;
66
67  // An array of warnings to show when displaying the route.
68  repeated string warnings = 7;
69
70  // The viewport bounding box of the polyline.
71  google.geo.type.Viewport viewport = 8;
72
73  // Additional information about the route.
74  RouteTravelAdvisory travel_advisory = 9;
75
76  // If ComputeRoutesRequest.optimize_waypoint_order is set to true, this field
77  // contains the optimized ordering of intermediates waypoints.
78  // otherwise, this field is empty.
79  // For example, suppose the input is Origin: LA; Intermediates: Dallas,
80  // Bangor, Phoenix;  Destination: New York; and the optimized intermediate
81  // waypoint order is:  Phoenix, Dallas, Bangor. Then this field contains the
82  // values [2, 0, 1]. The index starts with 0 for the first intermediate
83  // waypoint.
84  repeated int32 optimized_intermediate_waypoint_index = 10;
85}
86
87// Encapsulates the additional information that the user should be informed
88// about, such as possible traffic zone restriction etc.
89message RouteTravelAdvisory {
90  // The traffic restriction that applies to the route. A vehicle that is
91  // subject to the restriction is not allowed to travel on the route. As of
92  // October 2019, only Jakarta, Indonesia takes into consideration.
93  TrafficRestriction traffic_restriction = 1;
94
95  // Encapsulates information about tolls on the Route.
96  // This field is only populated if we expect there are tolls on the Route.
97  // If this field is set but the estimated_price subfield is not populated,
98  // we expect that road contains tolls but we do not know an estimated price.
99  // If this field is not set, then we expect there is no toll on the Route.
100  TollInfo toll_info = 2;
101
102  // Speed reading intervals detailing traffic density. Applicable in case of
103  // `TRAFFIC_AWARE` and `TRAFFIC_AWARE_OPTIMAL` routing preferences.
104  // The intervals cover the entire polyline of the route without overlap.
105  // The start point of a specified interval is the same as the end point of the
106  // preceding interval.
107  //
108  // Example:
109  //
110  //     polyline: A ---- B ---- C ---- D ---- E ---- F ---- G
111  //     speed_reading_intervals: [A,C), [C,D), [D,G).
112  repeated SpeedReadingInterval speed_reading_intervals = 3;
113
114  // Information related to the custom layer data that the customer specified
115  // (e.g. time spent in a customer specified area).
116  CustomLayerInfo custom_layer_info = 4;
117}
118
119// Encapsulates the additional information that the user should be informed
120// about, such as possible traffic zone restriction etc. on a route leg.
121message RouteLegTravelAdvisory {
122  // Encapsulates information about tolls on the specific RouteLeg.
123  // This field is only populated if we expect there are tolls on the RouteLeg.
124  // If this field is set but the estimated_price subfield is not populated,
125  // we expect that road contains tolls but we do not know an estimated price.
126  // If this field does not exist, then there is no toll on the RouteLeg.
127  TollInfo toll_info = 1;
128
129  // Speed reading intervals detailing traffic density. Applicable in case of
130  // `TRAFFIC_AWARE` and `TRAFFIC_AWARE_OPTIMAL` routing preferences.
131  // The intervals cover the entire polyline of the RouteLg without overlap.
132  // The start point of a specified interval is the same as the end point of the
133  // preceding interval.
134  //
135  // Example:
136  //
137  //     polyline: A ---- B ---- C ---- D ---- E ---- F ---- G
138  //     speed_reading_intervals: [A,C), [C,D), [D,G).
139  repeated SpeedReadingInterval speed_reading_intervals = 2;
140
141  // Information related to the custom layer data that the customer specified
142  // (e.g. time spent in a customer specified area).
143  CustomLayerInfo custom_layer_info = 3;
144}
145
146// Encapsulates the additional information that the user should be informed
147// about, such as possible traffic zone restriction on a leg step.
148message RouteLegStepTravelAdvisory {
149  // Speed reading intervals detailing traffic density. Applicable in case of
150  // `TRAFFIC_AWARE` and `TRAFFIC_AWARE_OPTIMAL` routing preferences.
151  // The intervals cover the entire polyline of the RouteLegStep without
152  // overlap. The start point of a specified interval is the same as the end
153  // point of the preceding interval.
154  //
155  // Example:
156  //
157  //     polyline: A ---- B ---- C ---- D ---- E ---- F ---- G
158  //     speed_reading_intervals: [A,C), [C,D), [D,G).
159  repeated SpeedReadingInterval speed_reading_intervals = 1;
160}
161
162// Encapsulates the traffic restriction applied to the route. As of October
163// 2019, only Jakarta, Indonesia takes into consideration.
164message TrafficRestriction {
165  // The restriction based on the vehicle's license plate last character. If
166  // this field does not exist, then no restriction on route.
167  LicensePlateLastCharacterRestriction
168      license_plate_last_character_restriction = 1;
169}
170
171// Encapsulates the license plate last character restriction.
172message LicensePlateLastCharacterRestriction {
173  // The allowed last character of a license plate of a vehicle. Only vehicles
174  // whose license plate's last characters match these are allowed to travel on
175  // the route. If empty, no vehicle is allowed.
176  repeated string allowed_last_characters = 1;
177}
178
179// Encapsulates a segment between non-`via` waypoints.
180message RouteLeg {
181  // The travel distance of the route leg, in meters.
182  int32 distance_meters = 1;
183
184  // The length of time needed to navigate the leg. If the `route_preference`
185  // is set to `TRAFFIC_UNAWARE`, then this value is the same as
186  // `static_duration`. If the `route_preference` is either `TRAFFIC_AWARE` or
187  // `TRAFFIC_AWARE_OPTIMAL`, then this value is calculated taking traffic
188  // conditions into account.
189  google.protobuf.Duration duration = 2;
190
191  // The duration of traveling through the leg, calculated without taking
192  // traffic conditions into consideration.
193  google.protobuf.Duration static_duration = 3;
194
195  // The overall polyline for this leg. This includes that each `step`'s
196  // polyline.
197  Polyline polyline = 4;
198
199  // The start location of this leg. This might be different from the provided
200  // `origin`. For example, when the provided `origin` is not near a road, this
201  // is a point on the road.
202  Location start_location = 5;
203
204  // The end location of this leg. This might be different from the provided
205  // `destination`. For example, when the provided `destination` is not near a
206  // road, this is a point on the road.
207  Location end_location = 6;
208
209  // An array of steps denoting segments within this leg. Each step represents
210  // one navigation instruction.
211  repeated RouteLegStep steps = 7;
212
213  // Encapsulates the additional information that the user should be informed
214  // about, such as possible traffic zone restriction etc. on a route leg.
215  RouteLegTravelAdvisory travel_advisory = 8;
216}
217
218// Encapsulates toll information on a `Route` or on a `RouteLeg`.
219message TollInfo {
220  // The monetary amount of tolls for the corresponding Route or RouteLeg.
221  // This list contains a money amount for each currency that is expected
222  // to be charged by the toll stations. Typically this list will contain only
223  // one item for routes with tolls in one currency. For international trips,
224  // this list may contain multiple items to reflect tolls in different
225  // currencies.
226  repeated google.type.Money estimated_price = 1;
227}
228
229// Encapsulates a segment of a `RouteLeg`. A step corresponds to a single
230// navigation instruction. Route legs are made up of steps.
231message RouteLegStep {
232  // The travel distance of this step, in meters. In some circumstances, this
233  // field might not have a value.
234  int32 distance_meters = 1;
235
236  // The duration of travel through this step without taking traffic conditions
237  // into consideration. In some circumstances, this field might not have a
238  // value.
239  google.protobuf.Duration static_duration = 2;
240
241  // The polyline associated with this step.
242  Polyline polyline = 3;
243
244  // The start location of this step.
245  Location start_location = 4;
246
247  // The end location of this step.
248  Location end_location = 5;
249
250  // Navigation instructions.
251  NavigationInstruction navigation_instruction = 6;
252
253  // Encapsulates the additional information that the user should be informed
254  // about, such as possible traffic zone restriction on a leg step.
255  RouteLegStepTravelAdvisory travel_advisory = 7;
256}
257
258message NavigationInstruction {
259  // Encapsulates the navigation instructions for the current step (e.g., turn
260  // left, merge, straight, etc.). This field determines which icon to display.
261  Maneuver maneuver = 1;
262
263  // Instructions for navigating this step.
264  string instructions = 2;
265}
266
267// A set of values that specify the navigation action to take for the current
268// step (e.g., turn left, merge, straight, etc.).
269enum Maneuver {
270  // Not used.
271  MANEUVER_UNSPECIFIED = 0;
272
273  // Turn slightly to the left.
274  TURN_SLIGHT_LEFT = 1;
275
276  // Turn sharply to the left.
277  TURN_SHARP_LEFT = 2;
278
279  // Make a left u-turn.
280  UTURN_LEFT = 3;
281
282  // Turn left.
283  TURN_LEFT = 4;
284
285  // Turn slightly to the right.
286  TURN_SLIGHT_RIGHT = 5;
287
288  // Turn sharply to the right.
289  TURN_SHARP_RIGHT = 6;
290
291  // Make a right u-turn.
292  UTURN_RIGHT = 7;
293
294  // Turn right.
295  TURN_RIGHT = 8;
296
297  // Go straight.
298  STRAIGHT = 9;
299
300  // Take the left ramp.
301  RAMP_LEFT = 10;
302
303  // Take the right ramp.
304  RAMP_RIGHT = 11;
305
306  // Merge into traffic.
307  MERGE = 12;
308
309  // Take the left fork.
310  FORK_LEFT = 13;
311
312  // Take the right fork.
313  FORK_RIGHT = 14;
314
315  // Take the ferry.
316  FERRY = 15;
317
318  // Take the train leading onto the ferry.
319  FERRY_TRAIN = 16;
320
321  // Turn left at the roundabout.
322  ROUNDABOUT_LEFT = 17;
323
324  // Turn right at the roundabout.
325  ROUNDABOUT_RIGHT = 18;
326}
327
328// Traffic density indicator on a contiguous segment of a polyline or path.
329// Given a path with points P_0, P_1, ... , P_N (zero-based index), the
330// SpeedReadingInterval defines an interval and describes its traffic using the
331// following categories.
332message SpeedReadingInterval {
333  // The classification of polyline speed based on traffic data.
334  enum Speed {
335    // Default value. This value is unused.
336    SPEED_UNSPECIFIED = 0;
337
338    // Normal speed, no slowdown is detected.
339    NORMAL = 1;
340
341    // Slowdown detected, but no traffic jam formed.
342    SLOW = 2;
343
344    // Traffic jam detected.
345    TRAFFIC_JAM = 3;
346  }
347
348  // The starting index of this interval in the polyline.
349  // In JSON, when the index is 0, the field appears to be unpopulated.
350  int32 start_polyline_point_index = 1;
351
352  // The ending index of this interval in the polyline.
353  // In JSON, when the index is 0, the field appears to be unpopulated.
354  int32 end_polyline_point_index = 2;
355
356  // Traffic speed in this interval.
357  Speed speed = 3;
358}
359
360// Encapsulates statistics about the time spent and distance travelled in a
361// custom area.
362message CustomLayerInfo {
363  // Encapsulates areas related information on a `Route` or on a `RouteLeg`.
364  message AreaInfo {
365    // ID of an area inside a customer provided dataset. An area represents a
366    // collection of polygons on the map that are of concern to the customer.
367    // For example, the customer may be interested in knowing whether a
368    // returned route is traveling through multiple busy city blocks during
369    // a predefined period of time. An area ID is unique within a single
370    // dataset uploaded by a customer. That is, a (customer_id, dataset_id,
371    // area_id) triplet should uniquely identify a set of polygons on the map
372    // that "activates" following a common schedule.
373    string area_id = 1;
374
375    // Total distance traveled in the area (in meters).
376    float distance_in_area_meters = 2;
377
378    // Total time spent in the area.
379    google.protobuf.Duration duration_in_area = 3;
380  }
381
382  // Encapsulates information about areas in the custom layer on the Route.
383  // This field is only populated if a route travels through areas in the
384  // custom layer.
385  repeated AreaInfo area_info = 1;
386}
387