route.proto 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339
  1. // Copyright 2021 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. // `route_preference` to `TRAFFIC_UNAWARE`, then this value is the same as
  44. // `static_duration`. If you set the `route_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. }
  63. // Encapsulates the additional information that the user should be informed
  64. // about, such as possible traffic zone restriction etc.
  65. message RouteTravelAdvisory {
  66. // The traffic restriction that applies to the route. A vehicle that is
  67. // subject to the restriction is not allowed to travel on the route. As of
  68. // October 2019, only Jakarta, Indonesia takes into consideration.
  69. TrafficRestriction traffic_restriction = 1;
  70. // Encapsulates information about tolls on the Route.
  71. // This field is only populated if we expect there are tolls on the Route.
  72. // If this field is set but the estimated_price subfield is not populated,
  73. // we expect that road contains tolls but we do not know an estimated price.
  74. // If this field is not set, then we expect there is no toll on the Route.
  75. TollInfo toll_info = 2;
  76. // Speed reading intervals detailing traffic density. Applicable in case of
  77. // `TRAFFIC_AWARE` and `TRAFFIC_AWARE_OPTIMAL` routing preferences.
  78. // The intervals cover the entire polyline of the route without overlap.
  79. // The start point of a specified interval is the same as the end point of the
  80. // preceding interval.
  81. //
  82. // Example:
  83. //
  84. // polyline: A ---- B ---- C ---- D ---- E ---- F ---- G
  85. // speed_reading_intervals: [A,C), [C,D), [D,G).
  86. repeated SpeedReadingInterval speed_reading_intervals = 3;
  87. }
  88. // Encapsulates the additional information that the user should be informed
  89. // about, such as possible traffic zone restriction etc. on a route leg.
  90. message RouteLegTravelAdvisory {
  91. // Encapsulates information about tolls on the specific RouteLeg.
  92. // This field is only populated if we expect there are tolls on the RouteLeg.
  93. // If this field is set but the estimated_price subfield is not populated,
  94. // we expect that road contains tolls but we do not know an estimated price.
  95. // If this field does not exist, then there is no toll on the RouteLeg.
  96. TollInfo toll_info = 1;
  97. // Speed reading intervals detailing traffic density. Applicable in case of
  98. // `TRAFFIC_AWARE` and `TRAFFIC_AWARE_OPTIMAL` routing preferences.
  99. // The intervals cover the entire polyline of the RouteLg without overlap.
  100. // The start point of a specified interval is the same as the end point of the
  101. // preceding interval.
  102. //
  103. // Example:
  104. //
  105. // polyline: A ---- B ---- C ---- D ---- E ---- F ---- G
  106. // speed_reading_intervals: [A,C), [C,D), [D,G).
  107. repeated SpeedReadingInterval speed_reading_intervals = 2;
  108. }
  109. // Encapsulates the additional information that the user should be informed
  110. // about, such as possible traffic zone restriction on a leg step.
  111. message RouteLegStepTravelAdvisory {
  112. // Speed reading intervals detailing traffic density. Applicable in case of
  113. // `TRAFFIC_AWARE` and `TRAFFIC_AWARE_OPTIMAL` routing preferences.
  114. // The intervals cover the entire polyline of the RouteLegStep without
  115. // overlap. The start point of a specified interval is the same as the end
  116. // point of the preceding interval.
  117. //
  118. // Example:
  119. //
  120. // polyline: A ---- B ---- C ---- D ---- E ---- F ---- G
  121. // speed_reading_intervals: [A,C), [C,D), [D,G).
  122. repeated SpeedReadingInterval speed_reading_intervals = 1;
  123. }
  124. // Encapsulates the traffic restriction applied to the route. As of October
  125. // 2019, only Jakarta, Indonesia takes into consideration.
  126. message TrafficRestriction {
  127. // The restriction based on the vehicle's license plate last character. If
  128. // this field does not exist, then no restriction on route.
  129. LicensePlateLastCharacterRestriction license_plate_last_character_restriction = 1;
  130. }
  131. // Encapsulates the license plate last character restriction.
  132. message LicensePlateLastCharacterRestriction {
  133. // The allowed last character of a license plate of a vehicle. Only vehicles
  134. // whose license plate's last characters match these are allowed to travel on
  135. // the route. If empty, no vehicle is allowed.
  136. repeated string allowed_last_characters = 1;
  137. }
  138. // Encapsulates a segment between non-`via` waypoints.
  139. message RouteLeg {
  140. // The travel distance of the route leg, in meters.
  141. int32 distance_meters = 1;
  142. // The length of time needed to navigate the leg. If the `route_preference`
  143. // is set to `TRAFFIC_UNAWARE`, then this value is the same as
  144. // `static_duration`. If the `route_preference` is either `TRAFFIC_AWARE` or
  145. // `TRAFFIC_AWARE_OPTIMAL`, then this value is calculated taking traffic
  146. // conditions into account.
  147. google.protobuf.Duration duration = 2;
  148. // The duration of traveling through the leg, calculated without taking
  149. // traffic conditions into consideration.
  150. google.protobuf.Duration static_duration = 3;
  151. // The overall polyline for this leg. This includes that each `step`'s
  152. // polyline.
  153. Polyline polyline = 4;
  154. // The start location of this leg. This might be different from the provided
  155. // `origin`. For example, when the provided `origin` is not near a road, this
  156. // is a point on the road.
  157. Location start_location = 5;
  158. // The end location of this leg. This might be different from the provided
  159. // `destination`. For example, when the provided `destination` is not near a
  160. // road, this is a point on the road.
  161. Location end_location = 6;
  162. // An array of steps denoting segments within this leg. Each step represents
  163. // one navigation instruction.
  164. repeated RouteLegStep steps = 7;
  165. // Encapsulates the additional information that the user should be informed
  166. // about, such as possible traffic zone restriction etc. on a route leg.
  167. RouteLegTravelAdvisory travel_advisory = 8;
  168. }
  169. // Encapsulates toll information on a `Route` or on a `RouteLeg`.
  170. message TollInfo {
  171. // The monetary amount of tolls for the corresponding Route or RouteLeg.
  172. // This list contains a money amount for each currency that is expected
  173. // to be charged by the toll stations. Typically this list will contain only
  174. // one item for routes with tolls in one currency. For international trips,
  175. // this list may contain multiple items to reflect tolls in different
  176. // currencies.
  177. repeated google.type.Money estimated_price = 1;
  178. }
  179. // Encapsulates a segment of a `RouteLeg`. A step corresponds to a single
  180. // navigation instruction. Route legs are made up of steps.
  181. message RouteLegStep {
  182. // The travel distance of this step, in meters. In some circumstances, this
  183. // field might not have a value.
  184. int32 distance_meters = 1;
  185. // The duration of travel through this step without taking traffic conditions
  186. // into consideration. In some circumstances, this field might not have a
  187. // value.
  188. google.protobuf.Duration static_duration = 2;
  189. // The polyline associated with this step.
  190. Polyline polyline = 3;
  191. // The start location of this step.
  192. Location start_location = 4;
  193. // The end location of this step.
  194. Location end_location = 5;
  195. // Navigation instructions.
  196. NavigationInstruction navigation_instruction = 6;
  197. // Encapsulates the additional information that the user should be informed
  198. // about, such as possible traffic zone restriction on a leg step.
  199. RouteLegStepTravelAdvisory travel_advisory = 7;
  200. }
  201. message NavigationInstruction {
  202. // Encapsulates the navigation instructions for the current step (e.g., turn
  203. // left, merge, straight, etc.). This field determines which icon to display.
  204. Maneuver maneuver = 1;
  205. // Instructions for navigating this step.
  206. string instructions = 2;
  207. }
  208. // A set of values that specify the navigation action to take for the current
  209. // step (e.g., turn left, merge, straight, etc.).
  210. enum Maneuver {
  211. // Not used.
  212. MANEUVER_UNSPECIFIED = 0;
  213. // Turn slightly to the left.
  214. TURN_SLIGHT_LEFT = 1;
  215. // Turn sharply to the left.
  216. TURN_SHARP_LEFT = 2;
  217. // Make a left u-turn.
  218. UTURN_LEFT = 3;
  219. // Turn left.
  220. TURN_LEFT = 4;
  221. // Turn slightly to the right.
  222. TURN_SLIGHT_RIGHT = 5;
  223. // Turn sharply to the right.
  224. TURN_SHARP_RIGHT = 6;
  225. // Make a right u-turn.
  226. UTURN_RIGHT = 7;
  227. // Turn right.
  228. TURN_RIGHT = 8;
  229. // Go straight.
  230. STRAIGHT = 9;
  231. // Take the left ramp.
  232. RAMP_LEFT = 10;
  233. // Take the right ramp.
  234. RAMP_RIGHT = 11;
  235. // Merge into traffic.
  236. MERGE = 12;
  237. // Take the left fork.
  238. FORK_LEFT = 13;
  239. // Take the right fork.
  240. FORK_RIGHT = 14;
  241. // Take the ferry.
  242. FERRY = 15;
  243. // Take the train leading onto the ferry.
  244. FERRY_TRAIN = 16;
  245. // Turn left at the roundabout.
  246. ROUNDABOUT_LEFT = 17;
  247. // Turn right at the roundabout.
  248. ROUNDABOUT_RIGHT = 18;
  249. }
  250. // Traffic density indicator on a contiguous segment of a polyline or path.
  251. // Given a path with points P_0, P_1, ... , P_N (zero-based index), the
  252. // SpeedReadingInterval defines an interval and describes its traffic using the
  253. // following categories.
  254. message SpeedReadingInterval {
  255. // The classification of polyline speed based on traffic data.
  256. enum Speed {
  257. // Default value. This value is unused.
  258. SPEED_UNSPECIFIED = 0;
  259. // Normal speed, no slowdown is detected.
  260. NORMAL = 1;
  261. // Slowdown detected, but no traffic jam formed.
  262. SLOW = 2;
  263. // Traffic jam detected.
  264. TRAFFIC_JAM = 3;
  265. }
  266. // The starting index of this interval in the polyline.
  267. // In JSON, when the index is 0, the field appears to be unpopulated.
  268. int32 start_polyline_point_index = 1;
  269. // The ending index of this interval in the polyline.
  270. // In JSON, when the index is 0, the field appears to be unpopulated.
  271. int32 end_polyline_point_index = 2;
  272. // Traffic speed in this interval.
  273. Speed speed = 3;
  274. }