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 of polygon leans towards many vertices. #47

Closed
tillnagel opened this issue Oct 27, 2012 · 2 comments
Closed

Centroid of polygon leans towards many vertices. #47

tillnagel opened this issue Oct 27, 2012 · 2 comments

Comments

@tillnagel
Copy link
Owner

Currently, the centroid of a set of locations/vertices tends to move towards borders where many vertices are defined. This is due to the algorithm ("minimizes the sum of squared Euclidean distances between itself and each point in the set").

We need to calculate the correct centroid of a polygon.

Red circle indicates the centroid currently calculated by Unfolding. Green shows the correct centroid.

Centroid map example

tillnagel added a commit that referenced this issue Oct 27, 2012
Created some apps to interactively set locations and calculate centroid
with different algorithms. New getCentroidOfPolygon calculates it
correctly, but needs to be cleaned up and added to GeoUtils. Related to
#47
@gdad-s-river
Copy link

Is this something similar to

https://github.com/Mapbox/polylabel ? ( Medium post: http://bit.ly/mapbox-visual-centre )

@tillnagel
Copy link
Owner Author

Thanks @gdad-s-river. This has been fixed since a while. See GeoUtils#getCentroid

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

No branches or pull requests

2 participants