NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

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's gravatar image

bateesh
21112
accept rate: 0%

edited 29 Jul '19, 08:18

scai's gravatar image

scai ♦
33.3k21309459


Your question would seem to be rather out of scope for this site, I would suggest posing your question on the OSRM mailing list that is likely to get you faster and better results.

permanent link

answered 26 Jul '19, 20:27

SimonPoole's gravatar image

SimonPoole ♦
44.7k13326701
accept rate: 18%

Thank you.I have posted it there

(30 Jul '19, 10:02) bateesh
(30 Jul '19, 12:24) scai ♦

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×293
×85
×4

question asked: 26 Jul '19, 15:39

question was seen: 1,245 times

last updated: 30 Jul '19, 12:24

NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum