geopandas.GeoSeries.scale

GeoSeries.scale(xfact=1.0, yfact=1.0, zfact=1.0, origin='center')

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.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.scale(2, 3)
0                              POINT (1.00000 1.00000)
1       LINESTRING (1.00000 -2.00000, 1.00000 1.00000)
2    POLYGON ((2.50000 -3.00000, 4.50000 0.00000, 2...
dtype: geometry
>>> s.scale(2, 3, origin=(0, 0))
0                              POINT (2.00000 3.00000)
1       LINESTRING (2.00000 -3.00000, 2.00000 0.00000)
2    POLYGON ((6.00000 -3.00000, 8.00000 0.00000, 6...
dtype: geometry