Custom speed limit for osm ways

Hi

I am trying to use my custom speed for each osm ways. How I can do that? All the solutions are old and looks like does not apply to the new version. How should I do it? Is there any example code to do that?

Thanks

You mean you have a table of speeds for each OSM way ID? In this case it is probably best to create a new EncodedValue and a TagParser similar to how it is done here: Add footway encoded value by easbar · Pull Request #2707 · graphhopper/graphhopper · GitHub

In the handleWayTags method you will read your speed table and write the speed for the corresponding OSM way ID into your new EncodedValue. You can then use this EncodedValue in a custom model.

Thank you. I will try and let you know

Hi
I am trying to understand how GH assigns speed for a road.
If the speed is in osm tag, then thats the max-speed. What is the purpose of carAverageSpeedParser? When the speed limit in CarAverageSpeedParser is used? If my vehicle is a car, then the route is calculated based on these speeds?

CarAverageSpeedParser sets the value of the car_average_speed encoded value. This speed will be used as default in CustomWeighting. E.g. if car_average_speed=50 for some road the speed will be 50 unless there are more rules in the custom model like if: road_class==TERTIARY, multiply_by: 0.5, then it will be 25.

How exactly CarAverageSpeedParser derives the speed for each edge you can find out the easiest by looking at the code and/or the tests. It uses fixed speeds depending on the highway tag for example and also the maxspeed tag (and a few others) play a role.

Thank you so much for your answer.

So, if I have only car and do not add any condition (e.g., road_class==tertiary, multiply by:0.5), then the routing will be based on the speed map in CarAverageSpeedParser?

For the roads that have maxspeed in osm tag, the speed will be the maxspeed. And if the osm tag does not have max speed, then the max speed will be according to the speed map in CarAverageSpeedParser? and the actual free speed will be the max speed * 0.9?

For GH-8, does every link gets a speed using MaxSpeedCalculator? If I want to look at the link speeds for my route, how can I do that? Is there a way to add that info in my pathdetails (or at least get the the speed values)?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.