Project-OSRM / osrm-backend

Open Source Routing Machine - C++ backend
http://map.project-osrm.org
BSD 2-Clause "Simplified" License
6.34k stars 3.36k forks source link

Implementation of the function to generate different types(ex. car/foot/cycle) of routes from a same map.osrm file #5452

Closed TakuHum closed 2 months ago

TakuHum commented 5 years ago

Hi!

We consider to implement to support routing the different types of route with different profiles of API from a same map.osrm file.

It seems to be technically feasible (https://github.com/Project-OSRM/osrm-backend/issues/5436).

We have two questions to implement the feature. I’m looking forward to hearing from you soon.

  1. Would you tell me the files or folders or classes to be changed involved to achieve the above?

  2. We want to understand the structure of map.osrm file. Are there any specifications? Is it possible to change the structure?

Best regards,

danpat commented 5 years ago

@TakuHum For completely different profiles, you will need more than the .osrm file - it's possible that different profiles will include/exclude different parts of the map, so the .geometry and all other files would be different between profiles too.

Ultimately, the confusion here is about osrm-routed. Instead of making large complicated changes to how OSRM stores data in files, I suggest it would be significantly simpler to use a HTTP reverse proxy running in front of several osrm-routed backends, and map requests through to the appropriate backend based on the URL path.

There's an example nginx configuration in https://github.com/Project-OSRM/osrm-backend/issues/4517#issuecomment-330359238 that does exactly this.

TakuHum commented 5 years ago

@danpat

Thanks.

Somehow I understood that it is difficult. We will consider including using a reverse proxy.

TakuHum commented 5 years ago

@danpat

We are considering proceeding with the reverse proxy as recommended by you. However, we would like to consider the method of the title as an alternative.

Which part of the source code has been published for osrm-extract, osrm-contract, and osrm-routing? If it is not released, is it possible to get it?

Is the programming language C++?

Best regards,

danpat commented 5 years ago

@TakuHum All the source code for OSRM resides in this GitHub repository. Click on the "Code" link on the top-left.

I do not think embedding multiple profiles within a single OSRM file is a good idea. It will be quite a complicated change, and won't achieve anything that you could do by instantiating multiple separate OSRM threads/workers/processes. Ultimately, there would be very little shared data between different profiles, so you'd effectively be generating multiple .osrm files anyway.

If you take a look at https://github.com/Project-OSRM/osrm-backend/blob/master/example/example.cpp, you will see how to query OSRM using the C++ library interface. It's quite simple to instantiate multiple OSRM objects within a single program, each one pointing at different data files. The same can be done in NodeJS using the Node bindings we supply, or at the HTTP level by using a reverse HTTP proxy like nginx. Any of these options would be significantly simpler than making OSRM capable of embedding multiple data profiles within the same fileset.

github-actions[bot] commented 3 months ago

This issue seems to be stale. It will be closed in 30 days if no further activity occurs.