geopandas.GeoSeries.rotate#
- GeoSeries.rotate(angle, origin='center', use_radians=False)[来源]#
返回一个
GeoSeries,其几何图形已经旋转。有关详细信息,请参见 http://shapely.readthedocs.io/en/latest/manual.html#shapely.affinity.rotate。
- Parameters:
- anglefloat
旋转角度可以通过设置 use_radians=True 以度数(默认)或弧度指定。正角度为逆时针旋转,负角度为顺时针旋转。
- originstring, Point, or tuple (x, y)
原点可以是一个关键字‘center’用于边界框中心(默认)、‘centroid’用于几何的重心、一个点对象或一个坐标元组 (x, y)。
- use_radiansboolean
是否将旋转角度解释为度数或弧度
示例
>>> 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.rotate(90) 0 POINT (1 1) 1 LINESTRING (1.5 -0.5, 0.5 -0.5) 2 POLYGON ((4.5 -0.5, 3.5 0.5, 2.5 -0.5, 4.5 -0.5)) dtype: geometry
>>> s.rotate(90, origin=(0, 0)) 0 POINT (-1 1) 1 LINESTRING (1 1, 0 1) 2 POLYGON ((1 3, 0 4, -1 3, 1 3)) dtype: geometry