-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Determine speed limit for route #5286
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I got the answer. The given speed is of m/s unit and we need to convert it in km/h. |
@parsispresswala Note that the speed value returned by OSRM is the speed we decide for routing, not exactly the In order to fetch the actual |
@danpat Thanks for tip. |
Hello, Can I get speed limit of route by changing some code in car.lua profile? If yes, what changes do I have to made? |
@danpat is https://github.com/mapbox/route-annotator also how Mapbox Directions annotates the response with a |
Hey guys, Allow me to squeeze in here with a related question. I'm trying to get speed limits (used by OSRM, don't need exact Here is a very short route I'm using: http://router.project-osrm.org/route/v1/driving/-88.900584,42.225831;-88.881613,42.233121?steps=true&annotations=speed There are 4 steps and 9 locations if you decode the The What I want to achieve is to relate speed values to each of the steps. Like:
Any advice on how to read and interpret that |
@parsispresswala 1 m/s = 3.6 km/h @pavlo-tk Use the geometry in the step and ignore repeated coordinates. You can get decoded values by passing |
If you just need it for each step, note that the RouteStep object has a |
I am using OSMBonusPack for OSM based map on Android i am querying https://router.project-osrm.org/route/v1/driving/105.8680712896,20.9947322000;105.8922453000,21.0393411000?alternatives=true&overview=full&steps=true to get the data. Now i want the speed limit between each node. Can anybody guide me how to do that ? |
is there any working example how to get actual route speed limit ? |
Do you finally found the solution of this ? |
no sorry |
I ended up building a bespoke solution using OSM data. But haven't found a way to query it in OSRM. |
I was wondering, if there is an easy way to extend the annotations with max speed. Some of the annotations, like weight, should have the same value as calculated in lua, right? So it should also be possible to include the max speed somehow. In Guess we have to add it in lua first, then store it somewhere in |
OSRM isn't a general purpose OSM query tool, so trying to get some of this data is never as easy as it feels like it should be. A quick-n-dirty way to get speed limit information is to encode it in the
|
Thanks @danpat, this is actually something i tried already, but then i saw that there are various checks, that use the roadname for some additional logic. One case for example is this:
In this case the check will always be false, as we attach the speed limit after the name. Another one here which is used in various places: osrm-backend/include/engine/guidance/collapsing_utility.hpp Lines 123 to 149 in 95c4523
And here:
So from my understanding this could cause issues in recognizing some szenarios. Or are my concerns not justifioed in these cases? |
@SamuelBrucksch Depends what you're looking to get out of the result. None of the code you linked will impact the route that is found. What will change is the detail in the If you need the route steps to be sensible(ish) and fit for human consumption, then this isn't the way to go. |
Thanks for more detailed explanation. That this does not affect the route is what I expected, as this affects guidance only. However |
Ok so i did some further investigation on this and it really breaks a few instructions, so this is not really the way to go. @danpat what would be the easiest way, to get maxspeed (or other metadata) into the route similiar to the annotations for example? I saw a PR here, that adds the way_ids to the annotations: My assumption would be, that if we can add the way_ids to the annotations, it should also be possible to add the speed limits instead for that way. However that PR is not merged for 2 years and the memory consumption increased, so not sure if that is a solution we should follow. My other idea was to add metadata from lua in a certain way, then grab it in OSRM and add a new MetaData instruction, which is hidden and not touched anywhere, except in the route to json before sending it back. Is that something which could work? And if so do you have some hints for me how to start on this? Or is there any other approach, that would work better than reusing the name? There actually are other routing APIs, for example HERE, that allow adding metadata like speed limits, elevation and so on to be returned as part of the route, so i think this is a valid usecase, especially for navigation solutions that don't have internet on the way. Found another related issue: |
Yep, for sure - but they also don't give you the routing engine itself, so it's not clear what their runtime requirements are on the backend - probably quite big if they're returning all that extra metadata :-) Ultimately, the conflict here is that OSRM isn't really a general-purpose road network database - its focus is on pathfinding. Years ago, I wrote https://github.com/mapbox/route-annotator which allows you to take a sequence of OSM node IDs and retrieve all the tags between all the pairs of nodes in the route - but you'd need to run that service separately, and it is also quite memory hungry. Other open source routing engines like Valhalla and pgRouting store some extra fields, as they allow them to be used for route selection. But there's no free lunch - if you want that extra data, you have to store it somewhere, so your memory/disk needs get bigger. |
But max_speed is already used while finding the route, so can't we just somehow add the meta data on the fly while putting together the route? If route-annotator also is memory hungry and needs to run in parallel, it should be fine if OSRM consumes a bit more and runs as standalone application. I don't mind if this would b a custom solution like adding it to the names, so we can also do this on our own instance and not push it to the main version. I just would need a starting point / some help on where to inject the data or where to best grab it, so it can be added to the route in the end. |
The OSM If it were me, the quickest hack I can think of would be to:
Not very clean, but I think would be the fewest code changes. You could alternatively add a completely new edge property similar to |
Thanks for explaining. I'll check if that works for us. |
Did anyone actually try to use overpass api to get the speed limits for a route based on node IDs that are returned with |
This issue seems to be stale. It will be closed in 30 days if no further activity occurs. |
Hello guys,
I'm trying to find a way to obtain all the speed limits in km/h unit for a specific route using openstreetmap. Right now I am using annotation=speed but I don't understand the result.
My API of routing is something like this:
http://127.0.0.1:5000/route/v1/driving/72.860856,19.198877;72.860084,19.195128?steps=true&alternatives=false&geometries=geojson&annotations=speed
weight: 102,
distance: 1278.3,
annotation: {
speed: [
14.3,
14.4,
14.4,
14.3,
14.4,
14.1,
14.6,
14.5,
11.2,
11.1,
11,
11.2,
15.6,
11,
11.1,
11.1,
10.8,
11.3,
14.8,
15.6,
14.9,
14.1,
14.5,
14.4
]
},
summary: "Western Express Highway, Datta Mandir Road",
duration: 102
}
Anyone develop something similar, or does anything like this already exist?
Thanks!
The text was updated successfully, but these errors were encountered: