libpysal.cg.alpha_shape¶
- libpysal.cg.alpha_shape(xys, alpha)[source]¶
Alpha-shape delineation (Edelsbrunner, Kirkpatrick & Seidel, 1983) from a collection of points
- Parameters:
- xys
ndarray
(N, 2) array with one point per row and coordinates structured as X and Y
- alpha
python:float
Alpha value to delineate the alpha-shape
- xys
- Returns:
- shapes
GeoSeries
Polygon(s) resulting from the alpha shape algorithm. The GeoSeries object remains so even if only a single polygon is returned. There is no CRS included in the object. Note that the returned shape(s) may have holes, as per the definition of the shape in Edselbrunner et al. (1983)
- shapes
References
- Edelsbrunner, H., Kirkpatrick, D., & Seidel, R. (1983). On the shape of
a set of points in the plane. IEEE Transactions on information theory, 29(4), 551-559.
Examples
>>> pts = np.array([[0, 1], [3, 5], [4, 1], [6, 7], [9, 3]]) >>> alpha = 0.1 >>> poly = alpha_shape(pts, alpha) >>> poly 0 POLYGON ((0.00000 1.00000, 3.00000 5.00000, 6.... dtype: geometry >>> poly.centroid 0 POINT (4.69048 3.45238) dtype: geometry