geopandas.GeoSeries.translate#

GeoSeries.translate(xoff=0.0, yoff=0.0, zoff=0.0)[source]#

Returns a GeoSeries with translated geometries.

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

Parameters:
xoff, yoff, zofffloat, float, float

Amount of offset along each dimension. xoff, yoff, and zoff for translation along the x, y, and z dimensions respectively.

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.translate(2, 3)
0                              POINT (3.00000 4.00000)
1        LINESTRING (3.00000 2.00000, 3.00000 3.00000)
2    POLYGON ((5.00000 2.00000, 6.00000 3.00000, 5....
dtype: geometry