MCPcopy Create free account
hub / github.com/shapely/shapely / offset_curve

Function offset_curve

shapely/constructive.py:271–342  ·  view source on GitHub ↗

Return a (Multi)LineString at a distance from the object. 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 r

(
    geometry, distance, quad_segs=8, join_style="round", mitre_limit=5.0, **kwargs
)

Source from the content-addressed store, hash-verified

269)
270@multithreading_enabled
271def offset_curve(
272 geometry, distance, quad_segs=8, join_style="round", mitre_limit=5.0, **kwargs
273):
274 """Return a (Multi)LineString at a distance from the object.
275
276 For positive distance the offset will be at the left side of the input
277 line. For a negative distance it will be at the right side. In general,
278 this function tries to preserve the direction of the input.
279
280 Note: the behaviour regarding orientation of the resulting line depends
281 on the GEOS version. With GEOS < 3.11, the line retains the same
282 direction for a left offset (positive distance) or has opposite direction
283 for a right offset (negative distance), and this behaviour was documented
284 as such in previous Shapely versions. Starting with GEOS 3.11, the
285 function tries to preserve the orientation of the original line.
286
287 Parameters
288 ----------
289 geometry : Geometry or array_like
290 Geometry or geometries for which to compute the offset.
291 distance : float or array_like
292 Specifies the offset distance from the input geometry. Negative
293 for right side offset, positive for left side offset.
294 quad_segs : int, default 8
295 Specifies the number of linear segments in a quarter circle in the
296 approximation of circular arcs.
297 join_style : {'round', 'bevel', 'mitre'}, default 'round'
298 Specifies the shape of outside corners. 'round' results in
299 rounded shapes. 'bevel' results in a beveled edge that touches the
300 original vertex. 'mitre' results in a single vertex that is beveled
301 depending on the ``mitre_limit`` parameter.
302 mitre_limit : float, default 5.0
303 Crops of 'mitre'-style joins if the point is displaced from the
304 buffered vertex by more than this limit.
305 **kwargs
306 See :ref:`NumPy ufunc docs <ufuncs.kwargs>` for other keyword arguments.
307
308 Notes
309 -----
310
311 .. deprecated:: 2.1.0
312 A deprecation warning is shown if ``quad_segs``, ``join_style`` or
313 ``mitre_limit`` are specified as positional arguments. In a future
314 release, these will need to be specified as keyword arguments.
315
316 Examples
317 --------
318 >>> import shapely
319 >>> from shapely import LineString
320 >>> line = LineString([(0, 0), (0, 2)])
321 >>> shapely.offset_curve(line, 2)
322 <LINESTRING (-2 0, -2 2)>
323 >>> shapely.offset_curve(line, -2)
324 <LINESTRING (2 0, 2 2)>
325
326 """
327 if isinstance(join_style, str):
328 join_style = BufferJoinStyle.get_value(join_style)

Callers

nothing calls this directly

Calls 2

get_valueMethod · 0.80
offset_curveMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…