Custom weights based on third party data

I’m wondering if there is support to apply my own custom weights to ways? I want to base this on third party data that I have. Do I need to add a new tag to OSM objects, or can it be handled on the ORS side?

If anyone has an example of doing something similar that’d be very helpful.

As long as you’re aware of OSM licensing restrictions regarding 3rd party data, you’ll have to handle it primarily on the ORS side.

It’s pretty involved though to define your own cost. You’ll have to write a data reader for whatever format your data comes in, somehow put that data in a memory efficient way either in the base graph or an extended storage, code the logic of the weighting and then (likely) expose a parameter over the API to control the parameter.

What data is it if I may ask?

I see. You may, but I can only say as much as it’s data affecting the speed at which one can travel by car on that road. I guess a different solution is to emulate low speed by blocking a road with the avoid_polygons option, as I’ve seen done in some of your examples. By the way, I haven’t been able to understand what weights are applied by default, i.e. more details on what algorithms are used by ORS. Can you point me to some information on that?

there are different speed settings for different waytypes. If you have a local setup check out the flagencoders

We don’t do much extra-weighting other than distance or time (one extra one would be turn costs), so the information Amandus gave you is most relevant. Most customization to the route finding are based on hard restrictions like vehicle dimensions or track grades. That’s mostly to restrict not using some roads/paths.

It’s all Dijkstra, A*/ALT and some speedups like contraction hierarchies, RPHAST for one/many-to-many.