如何从 lon/lat 坐标计算形状并用 plotly 绘制

How to calculate the shape from lon/lat coordinates and draw it with plotly

我有一个基于 plotly 的地图,其中我在 Mapbox 散点图中显示了几个坐标。现在我想从这些坐标中得到一个形状并在地图上绘制一个形状。

坐标可用 pandas.Series。下面是坐标的摘录。

0    [[51.795, 3.363], [51.79483333333334, 3.363], ...
1    [[51.42536, 2.622246666666667], [51.4256883333 ...

如何获得这些坐标的形状,这些坐标的边界是集群的最外层坐标?

在几何学中,基本上有两个主要概念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]。

如果你想要凸包,你可以使用 scipy.spatial.ConvexHull [4].

作为 scipy 的替代品,您还可以检查 geopandas and alphashape