prochitecture / blosm

GNU General Public License v3.0
11 stars 3 forks source link

Direction of a cluster or a two-way roadway #66

Open vvoovv opened 10 months ago

vvoovv commented 10 months ago

How is the direction of a cluster's centerline defined at the moment?

polarkernel commented 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.

vvoovv commented 10 months ago

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.

vvoovv commented 10 months ago

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.

vvoovv commented 10 months ago

The X-coordinates can be compared before the Y-coordinates.

polarkernel commented 10 months ago

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"
vvoovv commented 10 months ago

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.

vvoovv commented 10 months ago

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.