itinero / routing

The routing core of itinero.
Apache License 2.0
222 stars 70 forks source link

Merge two RouterDb objects #284

Open YuriiNskyi opened 4 years ago

YuriiNskyi commented 4 years ago

Are there any ways to merge two RouterDb objects?

For example, I have RouterDb with multiple streets inside, and want to add a new street without recalculating all RouterDb. Or, recalculate existing street into new RouterDb and merge these two databases. There are a lot of situations, where recalculating part of RouterDb would be useful.

wmpoolt commented 4 years ago

https://wiki.openstreetmap.org/wiki/Osmosis

https://wiki.openstreetmap.org/wiki/Osmconvert

juliusfriedman commented 4 years ago

I think @YuriiNskyi means specifically routerdb files, how can he concatenate or update them.

And I think @wmpoolt is suggesting you perform the conversion and combination in the osm format before you build your RouterDb.

Even if you could update the routerDb you would still need to parse the OSM to obtain the updates so it's kinda of a chicken and egg situation.

It's not that useful to update the routerDb when you can easily generate a new one after loading the OSM data although I might be missing edge cases.

YuriiNskyi commented 4 years ago

@juliusfriedman you are totally right, I meant specifically RouterDb files.

By manipulating with multiple RouterDb files, I thought I can solve traffic jams problem, something like updating RouterDb with another RouterDb with actual traffic information. This question is very similar to adding traffic information to RouterDb.

xivk commented 4 years ago

This is not supported out of the box with Itinero but it is probably doable to write some custom code that can handle this. Depends what type of data you are 'merging' obv.

It is possible to for example keep nodeids from OSM as meta data in the routerdb. If you do that it should be possible to match vertices together and merge them. The only issue you will most likely have at the edge of the network is that nodes that are not intersections are not converted to vertices. This could lead to a situation where you have two routerdb with a node used in one but dropped in another.