geopandas.GeoSeries.affine_transform

GeoSeries.affine_transform(matrix)

Return a GeoSeries with translated geometries.

See http://shapely.readthedocs.io/en/stable/manual.html#shapely.affinity.affine_transform for details.

Parameters
matrix: List or tuple

6 or 12 items for 2D or 3D transformations respectively.

For 2D affine transformations, the 6 parameter matrix is [a, b, d, e, xoff, yoff]

For 3D affine transformations, the 12 parameter matrix is [a, b, c, d, e, f, g, h, i, xoff, yoff, zoff]

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.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