Hi,
I am trying to compile project which uses osrm libraries and was written in 2017.I installed osrm server on my system yesterday and trying to make the application run.But while compiling on ubuntu 18.04 i am getting compilation errors.For eg,for the following code block
long long int OSRM_INTERFACE::viarouteCall(
vector<pair<float, float> > locations) {
// The following shows how to use the Route service; configure this service
osrm::RouteParameters route_parameters;
// route is in Monaco
route_parameters.service = "route";//route bateesh made chanfe from viaroutes to route
for (unsigned int i = 0; i < locations.size(); i++) {
route_parameters.AddCoordinate(locations[i].first, locations[i].second);
}
osrm::json::Object json_result;
const int result_code = (*routing_machine).RunQuery(route_parameters,
json_result);
//std::cout << "result code: " << result_code << std::endl;
long long int duration = 0;
// 2xx code
if (result_code / 100 == 2) {
// Extract data out of JSON structure
auto& summary = json_result.values["route_summary"].get<
osrm::json::Object>();
duration = summary.values["total_time"].get<osrm::json::Number>().value;
// auto distance =
// summary.values["total_distance"].get<osrm::json::Number>().value;
// //std::cout << "duration: " << duration << std::endl;
//std::cout << "distance: " << distance << std::endl;
}
//delete osrm;
return duration;
}
I am getting error during compilation like:-
error: ‘struct osrm::engine::api::RouteParameters’ has no member named ‘service’; did you mean ‘overview’?
route_parameters.service = "viaroute";
^~~~~~~
overview
src/osrm_interface.cpp:47:20: error: ‘struct osrm::engine::api::RouteParameters’ has no member named ‘AddCoordinate’; did you mean ‘coordinates’?
route_parameters.AddCoordinate(locations[i].first, locations[i].second);
^~~~~~~~~~~~~
coordinates
src/osrm_interface.cpp:51:45: error: ‘class osrm::OSRM’ has no member named ‘RunQuery’
const int result_code = (*routing_machine).RunQuery(route_parameters,
It seems to me as some API has changed and my machine is using new APIs and the code is built on old API.Can you tell me how can I see which parameters changes if i am correct?How do I make changes in the current code to use member names of new API?
asked 26 Jul '19, 15:39

bateesh
21●1●1●2
accept rate: 0%
edited 29 Jul '19, 08:18

scai ♦
33.3k●21●309●459
Thank you.I have posted it there
In case anyone is searching for it: https://lists.openstreetmap.org/pipermail/osrm-talk/2019-July/001790.html