roads.proto 4.0 KB

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