geopandas.GeoSeries.affine_transform#
- GeoSeries.affine_transform(matrix)#
返回一个
GeoSeries
使用平移的几何图形。有关详细信息,请参阅http://shapely.readthedocs.io/en/stable/manual.html#shapely.affinity.affine_transform。
- 参数
- 矩阵:列表或元组
分别用于2D或3D变换的6或12项。
对于2D仿射变换,6参数矩阵为
[a, b, d, e, xoff, yoff]
对于3D仿射变换,12参数矩阵为
[a, b, c, d, e, f, g, h, i, xoff, yoff, zoff]
示例
>>> 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.affine_transform([2, 3, 2, 4, 5, 2]) 0 POINT (10.00000 8.00000) 1 LINESTRING (4.00000 0.00000, 7.00000 4.00000) 2 POLYGON ((8.00000 4.00000, 13.00000 10.00000, ... dtype: geometry