Add a summary to each match result showing distance and duration.

Helpful for comparing how long the routing engine thinks the matched
trace should take to travel.
This commit is contained in:
Daniel Patterson
2015-11-13 17:57:07 -05:00
parent d5e4495f89
commit c7e30e2266
3 changed files with 46 additions and 1 deletions
+6
View File
@@ -238,6 +238,12 @@ template <class DataFacadeT> class MapMatchingPlugin : public BasePlugin
subtrace.values["instructions"] = json_descriptor.BuildTextualDescription(factory, temp_segments);
}
factory.BuildRouteSummary(factory.get_entire_length(),
raw_route.shortest_path_length);
osrm::json::Object json_route_summary;
json_route_summary.values["total_distance"] = factory.summary.distance;
json_route_summary.values["total_time"] = factory.summary.duration;
subtrace.values["route_summary"] = json_route_summary;
}
subtrace.values["indices"] = osrm::json::make_array(sub.indices);