route.proto 14 KB

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