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