Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Centroid computation for relations in some cases broken #96

Open
timonmasberg opened this issue Jul 20, 2021 · 2 comments
Open

Centroid computation for relations in some cases broken #96

timonmasberg opened this issue Jul 20, 2021 · 2 comments
Labels

Comments

@timonmasberg
Copy link

Describe the bug

Currently, centroids of relations are being calculated by detecting the largest area and calculating the centroid of it. This is broken for some relations, since members of relation-type outer cannot always be seen as one shape. For Hamburg there are multiple way objects that are describing the border. Choosing the largest area therefore is not helpful here.

Steps to Reproduce

Dataset: https://download.geofabrik.de/europe/germany/hamburg.html

Expected behavior

Detecting relation members as closed or open ways. If closed => calculate centroid, if open => create polygon out of them and compute centroid. Also, administrative relations have a admin_centre member, that could be used as a centroid.

Pastebin/Screenshots

Calculated centroid of Hamburg
image

Actual centroid of Hamburg
image

@missinglink
Copy link
Member

Thanks for the thoughtful bug report.

You're right, the polygon centroid calculations could be improved, would you be able to help out on this, I don't have a lot of time to work on it right now?

In that case specifically there is also a member node with the role admin_centre, we should probably favour those over computing geo centroids where available.

Screenshot_20210720-204618

@missinglink
Copy link
Member

This doesn't address the issue mentioned in the description, but it was an easy fix and would fix the Hamburg relation centroid and any other relation which has a node of role 'admin_centre': #98

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants