Вопрос

I am just about to implement a traffic simulation. For the road model, I use data from OpenStreetMap. This means that a road consists of several sections, which are strung together. Of those sections start and end points are known. The vehicle moves on the vector which points from the start to the end point. Curves are modeled by multiple vectors strung together.

In order to make the simulation as realistic as possible, I need a concept for the detection of curves so that the vehicles can respond to this (speed up / slow down). It should also be determined, at which point the curve begins, which cuts / points belonging to the bend and the point at which it ends.

How can I identify the curves, even if they contain an arbitrary number of small individual pieces?

Thanks for every hint!

Это было полезно?

Решение 2

First make sure you understand OSM's basic elements. There are nodes, ways and relations. You can skip relations because they don't contain geometry information (except for multipolygons which aren't used for defining roads).

Ways are defined by two or more nodes. Each way has a reference to all nodes it belongs to. Each node has coordinates and a reference to all ways it belongs to. This means a node can belong to more than one way, too. For example if it is at the end of a way then it will belong to all previous ways as well as to all next ways. Or it is somewhere in the middle of a way where it references all crossing ways because a way doesn't necessarily have to end at a junction.

Hence a curve can consist of one or more ways. So in order to detect curves, you have to look at consecutive nodes and consecutive ways at the same time. You will have to calculate road segments between every two consecutive nodes. The distance between consecutive nodes and the angle between consecutive road segments are the basis for determining if this is a curve or a straight line.

Другие советы

The road of OSM being made of segments instead of curves, you cannot get a curve radius.

Of course you could "guess" curves based on a set of road segments, but you will find that there is no universal way to do it, i.e. there will always have multiple curves in your guess list and none of them will be really proven to exist.

You cannot even count on the thickness of the road to describe a surface in which vehicles will move, as I doubt that this is contained in OSM's data. (Update: see the comment from the user scai below).

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top