geopandas.GeoSeries.translate#
- GeoSeries.translate(xoff=0.0, yoff=0.0, zoff=0.0)[来源]#
返回一个
GeoSeries,其中包含已翻译的几何图形。请参见 http://shapely.readthedocs.io/en/latest/manual.html#shapely.affinity.translate 获取详细信息。
- Parameters:
- xoff, yoff, zofffloat, float, float
每个维度上的偏移量。 xoff、yoff 和 zoff 分别用于沿 x、y 和 z 维度的平移。
示例
>>> from shapely.geometry import Point, LineString, Polygon >>> s = geopandas.GeoSeries( ... [ ... Point(1, 1), ... LineString([(1, -1), (1, 0)]), ... Polygon([(3, -1), (4, 0), (3, 1)]), ... ] ... ) >>> s 0 POINT (1 1) 1 LINESTRING (1 -1, 1 0) 2 POLYGON ((3 -1, 4 0, 3 1, 3 -1)) dtype: geometry
>>> s.translate(2, 3) 0 POINT (3 4) 1 LINESTRING (3 2, 3 3) 2 POLYGON ((5 2, 6 3, 5 4, 5 2)) dtype: geometry