cartagen.offset_line

Contents

cartagen.offset_line#

offset_line(line: LineString, offset: float, cap_style: Literal['round', 'flat'] = 'round', quad_segs: int = 8) List[Dict]#

Offset the vertices of a line on one side.

Offset the vertex of the line by a given distance and keeps the relationship between the line vertices and the result.

Parameters:
  • line (LineString) – The line to offset.

  • offset (float) – The length of the offset to apply in meters. Negative value for left-side dilation, positive for right-side.

  • cap_style ({'round', 'flat'}, optional) – The type of caps at the start and end of the line. Default is ‘round’.

  • quad_segs (int, optional) – The number of points allowed per circle quadrant when interpolating points using round method. Default is 8.

Returns:

list of dict – The index of each dict corresponds to the index of the provided points, with the keys:

  • ’type’: The type of point (‘start’, ‘concave’, ‘convex’, ‘end’)

  • ’original’: The index of the vertex inside the input line

  • ’projected’: The list of projected coordinates

Raises:

ValueError – If the line has fewer than 2 points, or if quad_segs < 1.

See also

dilate_line

This function loses the relationship between the provided line vertex and the offset points.

circle_interpolation

The function used to interpolate points along the quadrant of a circle.

(Source code)

../_images/offset_line.png