roads.proto 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. // Copyright 2019 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. //
  15. syntax = "proto3";
  16. package google.maps.roads.v1op;
  17. import "google/api/annotations.proto";
  18. import "google/api/client.proto";
  19. import "google/protobuf/wrappers.proto";
  20. import "google/type/latlng.proto";
  21. option go_package = "google.golang.org/genproto/googleapis/maps/roads/v1op;roads";
  22. option java_multiple_files = true;
  23. option java_outer_classname = "RoadsProto";
  24. option java_package = "com.google.maps.roads.v1op";
  25. service RoadsService {
  26. option (google.api.default_host) = "roads.googleapis.com";
  27. // This method takes a sequence of latitude,longitude points and snaps them to
  28. // the most likely road segments. Optionally returns additional points giving
  29. // the full road geometry. Also returns a place ID for each snapped point.
  30. rpc SnapToRoads(SnapToRoadsRequest) returns (SnapToRoadsResponse) {
  31. option (google.api.method_signature) = "path";
  32. }
  33. // This method takes a list of latitude,longitude points and snaps them each
  34. // to their nearest road. Also returns a place ID for each snapped point.
  35. rpc ListNearestRoads(ListNearestRoadsRequest)
  36. returns (ListNearestRoadsResponse) {
  37. option (google.api.method_signature) = "points";
  38. }
  39. }
  40. // A request to the SnapToRoads method, requesting that a sequence of points be
  41. // snapped to road segments.
  42. message SnapToRoadsRequest {
  43. // The path to be snapped as a series of lat, lng points. Specified as
  44. // a string of the format: lat,lng|lat,lng|...
  45. string path = 1;
  46. // Whether to interpolate the points to return full road geometry.
  47. bool interpolate = 2;
  48. // The asset ID of the asset to which this path relates. This is used for
  49. // abuse detection purposes for clients with asset-based SKUs.
  50. string asset_id = 3;
  51. // The type of travel being tracked. This will constrain the paths we snap to.
  52. TravelMode travel_mode = 4;
  53. }
  54. // An enum representing the mode of travel used for snapping.
  55. enum TravelMode {
  56. TRAVEL_MODE_UNSPECIFIED = 0;
  57. DRIVING = 1;
  58. CYCLING = 2;
  59. WALKING = 3;
  60. }
  61. // A snapped point object, representing the result of snapping.
  62. message SnappedPoint {
  63. // The lat,lng of the snapped location.
  64. google.type.LatLng location = 1;
  65. // The index into the original path of the equivalent pre-snapped point.
  66. // This allows for identification of points which have been interpolated if
  67. // this index is missing.
  68. google.protobuf.UInt32Value original_index = 2;
  69. // The place ID for this snapped location (road segment). These are the same
  70. // as are currently used by the Places API.
  71. string place_id = 3;
  72. }
  73. // The response from the SnapToRoads method, returning a sequence of snapped
  74. // points.
  75. message SnapToRoadsResponse {
  76. // A list of snapped points.
  77. repeated SnappedPoint snapped_points = 1;
  78. // User-visible warning message, if any, which can be shown alongside a valid
  79. // result.
  80. string warning_message = 2;
  81. }
  82. // A request to the ListNearestRoads method, requesting that a sequence of
  83. // points be snapped individually to the road segment that each is closest to.
  84. message ListNearestRoadsRequest {
  85. // The points to be snapped as a series of lat, lng points. Specified as
  86. // a string of the format: lat,lng|lat,lng|...
  87. string points = 1;
  88. // The type of travel being tracked. This will constrain the roads we snap to.
  89. TravelMode travel_mode = 2;
  90. }
  91. // The response from the ListNearestRoads method, returning a list of snapped
  92. // points.
  93. message ListNearestRoadsResponse {
  94. // A list of snapped points.
  95. repeated SnappedPoint snapped_points = 1;
  96. }