Open vvoovv opened 10 months ago
How is the direction of a cluster's centerline defined at the moment?
The direction is random. It points to the direction of the longest polyline in the cluster. Cluster construction involves many heuristics, this is one of them.
Probably later we will need to define the direction of a cluster and a two-way street in a deterministic way. It will be required for PML styling. For now let's keep it as is.
A possible solution could be to set the direction from the endpoint with the lower Y-coordinate to the endpoint with the higher Y-coordinate.
The direction of a cluster or a two-way roadway must be defined in a deterministic way.
I suggest to define the direction from the endpoint with the smaller Y-coordinate to the endpoint with the larger Y-coordinate. If the Y-coordinates of the endpoints are equal (with some tolerance), then the direction is defined from the endpoint with the smaller X-coordinate to the endpoint with the larger X-coordinate.
A special case is a circular cluster or a circular two-way roadway. The direction can be defined anticlockwise for the right-hand traffic and clockwise otherwise.
The X-coordinates can be compared before the Y-coordinates.
The direction of a cluster or a two-way roadway must be defined in a deterministic way.
I agree with these definitions for clusters. But two-way roadways already have a definition, given by OSM. Forward is in the direction of the drawing (the order of the nodes) and backward is in the opposite direction. These directions are then referenced, for example, for lanes:
turn:lanes:forward="slight_right|slight_right|right"
I had in mind the direction for PML styling of streets, for example, the width of footway to the left is 3 meter.
But PML styling for streets is currently in a very experimental state. Once PML styling for streets become more mature, two direction can be used for two-way streets: one from OSM and the other one for styling. For now let's define the direction as proposed above only for clusters.
The X-coordinates can be compared before the Y-coordinates.
I am in favor of comparison the Y-coordinates first, since the arrow in the traffic sign "Go straight ahead" points upwards.
How is the direction of a cluster's centerline defined at the moment?