Reputation: 115
I have a plotly
based map where I am showing several coordinates in a Mapbox scatter plot. Now I want to get a shape from these coordinates and draw a shape on the map.
The coordinates are available as a pandas.Series
. Below an extract of the coordinates.
0 [[51.795, 3.363], [51.79483333333334, 3.363], ...
1 [[51.42536, 2.622246666666667], [51.4256883333 ...
How can I get a shape for these coordinates which boundaries are the outmost coordinates of the cluster?
Upvotes: 2
Views: 1067
Reputation: 10372
In geometry, there are basically two main concepts Convex hull and Alpha shape (also called Concave hull) to get the shape of a finite set of points. The following picture should visually describe the differences between them [2].
In case you want to have the convex hull you can use scipy.spatial.ConvexHull
[4].
As alternatives to scipy
you can also check geopandas and alphashape.
Upvotes: 2