Osrm-backend: how to run it as a c++ library libosrm?

Created on 13 Nov 2019  路  7Comments  路  Source: Project-OSRM/osrm-backend

Hi. I really like this software and I'd like to know more about it. More specifically, I'd like to know how to run it as a c++ library libosrm and eventually, I might consider integrate it with julia. Now, here is what I have done so far.
Firstly, I followed this link to build it in my ubuntu workstation. https://github.com/Project-OSRM/osrm-backend/wiki/Building-on-Ubuntu
Then, I followed this link https://lists.openstreetmap.org/pipermail/osrm-talk/2016-October/001366.html to try to run it as libosrm using data myMapData.osm.pbf, which is downloaded from the internet.
After trying the following command, many files are created in the desktop,

~$ osrm-contract /home/Desktop/myMapData.osrm

Many different files have been created in the desktop. For example, myMapData.osrm.properties, myMapData.osrm.names, myMapData.osrm.nbg_nodes, myMapData.osrm.cnbg, myMapData.osrm.turn_penalties_index, myMapData.osrm.cnbg_to_ebg, myMapData.osrm.turn_weight_penalties, myMapData.osrm.turn_duration_penalties,
myMapData.osrm.restrictions, myMapData.osrm.maneuver_overrides, myMapData.osrm.icd,
myMapData.osrm.tls, myMapData.osrm.tld, myMapData.osrm.geometry, myMapData.osrm.enw,
myMapData.osrm.edges, myMapData.osrm.fileIndex, myMapData.osrm.ramIndex, myMapData.osrm.ebg_nodes, myMapData.osrm.datasource_names, myMapData.osrm.hsgr

I was a bit confused and need more comments or references. Any reply is greatly appreciated.

All 7 comments

Did you use the osrm-extract method before osrm-contract, as suggested in the example.cpp?

 // We support two routing speed up techniques:
    // - Contraction Hierarchies (CH): requires extract+contract pre-processing
    // - Multi-Level Dijkstra (MLD): requires extract+partition+customize pre-processing
config.algorithm = EngineConfig::Algorithm::CH;

you can then request routes using osrm-routed in terminal with "myMapData.orsm" as a program argument

@SegfaultCreator, I tried the command "osrm-routed" as the following:
$ osrm-routed /home/Desktop/myMapData.osm

[info] starting up engines, v5.22.0
[info] Threads: 12
[info] IP address: 0.0.0.0
[info] IP port: 5000
[info] http 1.1 compression handled by zlib version 1.2.11
[info] Listening on: 0.0.0.0:5000
[info] running and waiting for requests

@bsnyh
The server is now running.
You have to use another terminal to start your requests, e.g.:

curl "http://127.0.0.1:5000/nearest/v1/driving/7.42191,43.7331?number=1"

(Returns the closest road to a given position)

@SegfaultCreator, thank you very much. How to use another terminal to start the requests? Moreover, I'd like to use it as a c++ library in a new framework written in Python or Julia, more than likely without the server support. Do you happen to have any suggestions?

@bsnyh
The server is now running.
You have to use another terminal to start your requests, e.g.:

curl "http://127.0.0.1:5000/nearest/v1/driving/7.42191,43.7331?number=1"

(Returns the closest road to a given position)

Could you kindly explain more about the parameters of the url link?

@bsnyh You should read the API documentation which is available here:

http://project-osrm.org/docs/v5.22.0/api/

It describes how to construct URLs to make queries against a running OSRM server.

@danpat, thank you for your quick reply. is it possible to get it running as a c++ library, without internet connection? Moreover, I'd like to import it in a python or julia framework, do you have any suggestions about that?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

davidbarre picture davidbarre  路  4Comments

brunosan picture brunosan  路  5Comments

grib0 picture grib0  路  4Comments

MouadSb picture MouadSb  路  3Comments

zifeo picture zifeo  路  3Comments