Project-OSRM / osrm-backend

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

Use OSRM with dynamic input data taken from overpassAPI #6622

Closed fededige closed 1 month ago

fededige commented 1 year ago

Hi there, I'll start by saying that I am a complete newbie when it comes to Docker, etc. I'm trying to use an OSRM Docker container to calculate the cost matrix that I need to use Vroom. I managed to do it by downloading the data that I need from Geofabrik, using a small geographic area because of my limited hardware resources.

My question is: Is there a way to load the data in real-time without restarting the Docker container? In my use case, I'd like to ask the user for coordinates and download the OSM data around that point.

P.S. It's my first time using GitHub issues to ask a question, feel free to remove my question if it's not related or off-topic. Sorry for my broken English, and many thanks.

alexanderzatko commented 1 year ago

I am new to OSRM as well and I think I have a similar question, but let me first clarify the issue you are facing.

Why do you need to download just a portion of the known network (from the OSM db)? You can download a .pbf file that will contain all network segments your users might need to route on, which would eliminate the need to dynamically load your data sources, right? Is your intent to run your route queries against as small network as possible for performance (or resource constraint) reasons?

fededige commented 1 year ago

Yes, that's exactly the reason, I don't have enogh RAM capacity to preprocess a large pbf file. Also I don't really like to limit the user to a specific geographical area. For example, even if I had enough RAM and could preprocess the data for Italy (the specific geographical region I'm interested in), I wouldn't want to restrict user requests for other geographical areas.

alexanderzatko commented 1 year ago

My scenario is different, but in the end will likely also need dynamic loading of data sources, similar to the requirement described in this issue. In my case I will need to combine a base network provided in a .pbf file, with a custom network of ways created from segments left unmatched by the OSRM "match" service (after I clean them up a bit).

Iu general, my hunch is, that the ultimate solution to our requirement will use the "hot-swap mechanism" that relies on shared memory, mentioned for example in issue #5703. I haven't yet figured out how to do it however, as I am not really interested in hot-swapping traffic data, but whole networks.

alexanderzatko commented 1 year ago

...or there is no way to do this with OSRM, if I read the issue #6265 correctly.

nilsnolde commented 1 year ago

You can swap whole networks with shared memory (I think so at least, can't see a difference between 2 different networks and same network going through 2 different customizations), but you can't "append" edges/nodes to existing networks. None of the popular routing engines can do that (yet), but of course it'd be super interesting to be able to do that. pgRouting is your friend if you're set on that functionality (and don't need world-class performance).

@fededige you'll need to build the graphs for those mini networks, no difference to larger networks conceptually, just less ressources & faster turnaround time. What you want to do doesn't scale well.

alexanderzatko commented 1 year ago

@nilsnolde., thank you for clarifying this for me.

fededige commented 1 year ago

@nilsnolde thanks for the explanation, in fact I realized that this solution is not very scalable, as it would be difficult to serve multiple users at the same time.

github-actions[bot] commented 2 months ago

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