[OSRM-talk] Using libosrm

Daniel Hofmann hofmann at mapbox.com
Mon Oct 31 13:40:34 UTC 2016


Hej!

> My requirement is to, write a piece of code that takes start and end
locations and return the waypoints that the vehicle has to traverse
through.

First please make sure you have go as low-level as using libosrm the C++
library instead of using the high-level HTTP interface [0] or the NodeJS
bindings[1].

Now for using libosrm in C++ you have to follow the build steps. Assuming
you already have all the required dependencies, in the osrm-backend
directory do:

  mkdir build && cd build
  cmake ..
  make
  sudo make install

This will build and install libosrm and the osrm-* binaries. Then, in the
example directory:

  mkdir build
  cmake ..
  make

Builds the example program. The example program takes a *.osrm file and
runs routing queries on it.

To generate a *.osrm file you have to follow the Running OSRM steps.
Assuming you want to a routing network based on the car profile:

  osrm-extract -p profiles/car.lua map.osm.pbf
  osrm-contract map.osrm

You can get base maps for example from Geofabrik [2].

You will find detailed explanations for response objects in the docs [0].

Cheers,
Daniel J H


0
https://github.com/Project-OSRM/osrm-backend/blob/master/docs/http.md#http-api
1  https://github.com/Project-OSRM/node-osrm
2  http://www.geofabrik.de/data/download.html

On Sun, Oct 30, 2016 at 8:36 PM, Harikrishnan Lakshmanan <
lharikrishnan1993 at gmail.com> wrote:

> Hello all,
>
> Thanks for developing such a software and open sourcing it.
>
> I am a newbie and find it hard to use the libosrm library. I see that, an
> example has been provided and I don't understand how I should run it. After
> doing the cmake, I don't find the compiled binaries in the /use/local/*.
>
> 1. How do I run the 'example.cpp' file found under the examples folder?
> 2. On running the program, where do I get the list of waypoints from?
>
> My requirement is to, write a piece of code that takes start and end
> locations and return the waypoints that the vehicle has to traverse
> through.
>
> 3. After writing the code, where should I place it for proper compilation?
> Under /src ?
>
> Any help is highly appreciated.
>
> Thank you very much in advance.
> Regards,
>
> Hari
>
>
> _______________________________________________
> OSRM-talk mailing list
> OSRM-talk at openstreetmap.org
> https://lists.openstreetmap.org/listinfo/osrm-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/osrm-talk/attachments/20161031/60c9d663/attachment.html>


More information about the OSRM-talk mailing list