alexey-zakharenkov / subways

Subway Preprocessor and Validator
Apache License 2.0
12 stars 1 forks source link

Improve relation center calculation #34

Closed alexey-zakharenkov closed 1 year ago

alexey-zakharenkov commented 1 year ago

Solves #33 The problem was caused by circular relation references. By mistake, the stop_area relation 7588528 in OSM contained the stop_area_group relation 7588561 as a member, and it was a member of that stop_area_group itself. The calculate_centers() procedure failed to calculate center for such relations since it required all children to have calculated centers. A [stop_area] relation without a center could not be assigned to any city, so the "stop is not connected to a station" error appeared.

After the PR, if a relation has a relation member the center of which cannot be calculated, it is simply ignored and the center is calculated based on other members.