geopandas.GeoSeries.affine_transform#
- GeoSeries.affine_transform(matrix)[来源]#
返回一个
GeoSeries,其中包含翻译后的几何形状。请参阅 http://shapely.readthedocs.io/en/stable/manual.html#shapely.affinity.affine_transform 以获取更多详细信息。
- Parameters:
- matrix: List or tuple
分别为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 1) 1 LINESTRING (1 -1, 1 0) 2 POLYGON ((3 -1, 4 0, 3 1, 3 -1)) dtype: geometry
>>> s.affine_transform([2, 3, 2, 4, 5, 2]) 0 POINT (10 8) 1 LINESTRING (4 0, 7 4) 2 POLYGON ((8 4, 13 10, 14 12, 8 4)) dtype: geometry