geopandas.GeoSeries.interpolate#
- GeoSeries.interpolate(distance, normalized=False)[来源]#
返回每个几何体上指定距离的一个点
- Parameters:
- distancefloat or Series of floats
应返回的点在几何体上的距离。如果使用np.array或pd.Series,则必须与GeoSeries具有相同的长度。
- normalizedboolean
如果 normalized 为 True,距离将被解释为几何对象长度的一个分数。
示例
>>> from shapely.geometry import LineString, Point >>> s = geopandas.GeoSeries( ... [ ... LineString([(0, 0), (2, 0), (0, 2)]), ... LineString([(0, 0), (2, 2)]), ... LineString([(2, 0), (0, 2)]), ... ], ... ) >>> s 0 LINESTRING (0 0, 2 0, 0 2) 1 LINESTRING (0 0, 2 2) 2 LINESTRING (2 0, 0 2) dtype: geometry
>>> s.interpolate(1) 0 POINT (1 0) 1 POINT (0.70711 0.70711) 2 POINT (1.29289 0.70711) dtype: geometry
>>> s.interpolate([1, 2, 3]) 0 POINT (1 0) 1 POINT (1.41421 1.41421) 2 POINT (0 2) dtype: geometry