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。
- 参数
- Xoff,yoff,zoff浮动,浮动,浮动
沿每个维度的偏移量。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.00000 1.00000) 1 LINESTRING (1.00000 -1.00000, 1.00000 0.00000) 2 POLYGON ((3.00000 -1.00000, 4.00000 0.00000, 3... dtype: geometry
>>> s.translate(2, 3) 0 POINT (3.00000 4.00000) 1 LINESTRING (3.00000 2.00000, 3.00000 3.00000) 2 POLYGON ((5.00000 2.00000, 6.00000 3.00000, 5.... dtype: geometry