Reputation: 524
Im using Shapely library to deal with polygons. It has class called Polygon
which gets an ordered set of coordinates and turns them into a polygon.
The problem is that I got set of unordered coordinates. I want polygon which wraps all of the points.
I have been looking into Shapley documentation, but I can't find any information about how to do it
Is there an algorithm to order the points before sending them to Polygon
? Or is there another method I can do that?
Upvotes: 5
Views: 3401
Reputation: 1060
You can create a convex hull around the points but it will not ignore the points that are inside the hull
example from https://shapely.readthedocs.io/en/latest/manual.html#object.convex_hull
MultiPoint([(0, 0), (1, 1)]).convex_hull
Upvotes: 8