offset_curve(geometry, distance, quad_segs=8, join_style='round', mitre_limit=5.0, **kwargs)#

Returns a (Multi)LineString at a distance from the object on its right or its left side.

For positive distance the offset will be at the left side of the input line. For a negative distance it will be at the right side. In general, this function tries to preserve the direction of the input.

Note: the behaviour regarding orientation of the resulting line depends on the GEOS version. With GEOS < 3.11, the line retains the same direction for a left offset (positive distance) or has opposite direction for a right offset (negative distance), and this behaviour was documented as such in previous Shapely versions. Starting with GEOS 3.11, the function tries to preserve the orientation of the original line.

geometryGeometry or array_like
distancefloat or array_like

Specifies the offset distance from the input geometry. Negative for right side offset, positive for left side offset.

quad_segsint, default 8

Specifies the number of linear segments in a quarter circle in the approximation of circular arcs.

join_style{‘round’, ‘bevel’, ‘mitre’}, default ‘round’

Specifies the shape of outside corners. ‘round’ results in rounded shapes. ‘bevel’ results in a beveled edge that touches the original vertex. ‘mitre’ results in a single vertex that is beveled depending on the mitre_limit parameter.

mitre_limitfloat, default 5.0

Crops of ‘mitre’-style joins if the point is displaced from the buffered vertex by more than this limit.


See NumPy ufunc docs for other keyword arguments.


>>> from shapely import LineString
>>> line = LineString([(0, 0), (0, 2)])
>>> offset_curve(line, 2)
<LINESTRING (-2 0, -2 2)>
>>> offset_curve(line, -2)
<LINESTRING (2 0, 2 2)>