geopandas.GeoSeries.scale#

GeoSeries.scale(xfact=1.0, yfact=1.0, zfact=1.0, origin='center')[source]#

Returns a GeoSeries with scaled geometries.

The geometries can be scaled by different factors along each dimension. Negative scale factors will mirror or reflect coordinates.

See http://shapely.readthedocs.io/en/latest/manual.html#shapely.affinity.scale for details.

Parameters:
xfact, yfact, zfactfloat, float, float

Scaling factors for the x, y, and z dimensions respectively.

originstring, Point, or tuple

The point of origin can be a keyword ‘center’ for the 2D bounding box center (default), ‘centroid’ for the geometry’s 2D centroid, a Point object or a coordinate tuple (x, y, z).

Examples

>>> 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.scale(2, 3)
0                                 POINT (1 1)
1                      LINESTRING (1 -2, 1 1)
2    POLYGON ((2.5 -3, 4.5 0, 2.5 3, 2.5 -3))
dtype: geometry
>>> s.scale(2, 3, origin=(0, 0))
0                         POINT (2 3)
1              LINESTRING (2 -3, 2 0)
2    POLYGON ((6 -3, 8 0, 6 3, 6 -3))
dtype: geometry