'How to get maxspeed from overpass for multilevel intersections/roads?
How can I get speed limit for multilevel intersections/roads? When I go over the bridge or under the bridge, I can get wrong speed limit.
I am using: way[maxspeed](around:20, <latitude>, <longitude>)
, but I cannot specific altitude
.
I am using Overpass API
by OpenStreetMaps
.
Solution 1:[1]
Unfortunately, your current approach of considering speed limits of any road within a certain radius around your location is likely to struggle not just at multilevel intersections, but also with parallel roads and at regular intersections involving ways with different speed limits. It assumes that you know your location with an accuracy that you won't have available in many use cases, and fails in 3 dimensions because OpenStreetMap data does not contain altitude information, only a vertical ordering (i.e. whether an object is above or below another).
It seems to me that the problem you need to solve is finding out which road you're actually on. Once you know the road, you can easily access any of its attributes, including those relevant to speed limits.
This problem of finding the corresponding road for a location, and preferably a history of past locations, is called map matching. For OpenStreetMap data, I believe GraphHopper offers a map matching implementation and API.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Tordanik |