diff --git a/proto/tripdirections.proto b/proto/tripdirections.proto index 0aeba4f..dabe802 100644 --- a/proto/tripdirections.proto +++ b/proto/tripdirections.proto @@ -6,6 +6,11 @@ message TripDirections { optional float lat = 1; optional float lng = 2; } + + message BoundingBox { + optional LatLng min_ll = 1; + optional LatLng max_ll = 2; + } message Location { enum Type { @@ -35,6 +40,7 @@ message TripDirections { message Summary { optional float length = 1; // kilometers or miles based on units optional uint32 time = 2; // seconds + optional BoundingBox bbox = 3; // Bounding box of the shape } message TransitStop { diff --git a/proto/trippath.proto b/proto/trippath.proto index 3384d36..2b5d497 100644 --- a/proto/trippath.proto +++ b/proto/trippath.proto @@ -6,6 +6,11 @@ message TripPath { optional float lat = 1; optional float lng = 2; } + + message BoundingBox { + optional LatLng min_ll = 1; + optional LatLng max_ll = 2; + } message Location { enum Type { @@ -215,6 +220,6 @@ message TripPath { repeated Node node = 5; repeated Admin admin = 6; optional string shape = 7; - + optional BoundingBox bbox = 8; } diff --git a/src/odin/directionsbuilder.cc b/src/odin/directionsbuilder.cc index 2e24296..53c08cf 100644 --- a/src/odin/directionsbuilder.cc +++ b/src/odin/directionsbuilder.cc @@ -392,6 +392,11 @@ TripDirections DirectionsBuilder::PopulateTripDirections( etp->GetLength(directions_options.units())); trip_directions.mutable_summary()->set_time( etp->node(etp->GetLastNodeIndex()).elapsed_time()); + auto mutable_bbox = trip_directions.mutable_summary()->mutable_bbox(); + mutable_bbox->mutable_min_ll()->set_lat(etp->bbox().min_ll().lat()); + mutable_bbox->mutable_min_ll()->set_lng(etp->bbox().min_ll().lng()); + mutable_bbox->mutable_max_ll()->set_lat(etp->bbox().max_ll().lat()); + mutable_bbox->mutable_max_ll()->set_lng(etp->bbox().max_ll().lng()); // Populate shape trip_directions.set_shape(etp->shape());