prochitecture / blosm

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

Detecting and processing crosswalks #73

Open vvoovv opened 11 months ago

vvoovv commented 11 months ago

A crosswalk is represented in OSM as a node and tagged with crossing=*. Quite often (but not always) a node representing a crosswalk is shared by an OSM-way representing a roadway (e.g. highway=primary) and an OSM-way tagged with highway=footway.

It's quite easy to detect a crosswalk for a street with a single roadway: just iterate through the nodes of the OSM-way and find the nodes tagged with crossing=*.

Processing the case of a single roadway: (1) If a crosswalk-node is located in the middle of an OSM-way, then the related Section must be split. The crosswalk width is read from the PML style. The resulting two Sections are cropped by the half of the crosswalk width.

(2) If a crosswalk-node is shared by two neighbor OSM-ways. then the related Sections are cropped by the half of the crosswalk width.

(3) If a crosswalk-node is located at an open end of the Section, then the Section is cropped by the crosswalk width.

vvoovv commented 11 months ago

Detecting and processing a crosswalk for a bundle is more challenging. A crosswalk must cross all roadways in the bundle.

Examples of a crosswalk in a bundle.

(Karl-Marx-Allee): image

(Beijing OSM - Baidu Maps Street View - Baidu Maps Satellite): image

Nodes with crossing=* that form a crosswalk through a bundle, must be on an OSM-way with highway=footway.

vvoovv commented 11 months ago

A complex processing may be required for a crosswalk across a bundle. The same kind of processing may be required for a crosswalk across a single roadway if the related OSM-way with highway=footway is taken into account.

image

The centerline of the crosswalk (green line) is offsetted (blue lines) along the centerline of the roadway (red line). Intersection points (red circles) of the resulting polylines with the borders of the roadway are found. Those intersection points are projected (orange lines) on the opposite border of the roadway. The section is split at blue circles. A polygon (blue-orange-black lines) on each side of the crosswalk is formed. A reference to the polygon is kept at newly generated sections.