flatten_lines

Contents

flatten_lines#

zeroheliumkit.src.utils.flatten_lines(line1: LineString, line2: LineString, bypass_alignment: bool = True) LineString[source]#

Appends line2 to line1 and returning a new LineString object. The last point of line1 and the first point of line2 are assumed to be the same.

Parameters:
  • line1 (LineString) – The first LineString object.

  • line2 (LineString) – The second LineString object.

  • bypass_alignment (bool) – If True, the function will not check that the last point of line1 and the first point of line2 are the same. Defaults to False.

Returns:

A new LineString object formed by flattening line1 with line2.

Return type:

LineString

Raises:

ValueError – If the last point of the first line and the first point of the second line are not the same

Example

>>> line1 = LineString([(0, 0), (1, 1)])
>>> line2 = LineString([(2, 2), (3, 3)])
>>> result = flatten_lines(line1, line2)
>>> print(result)
    LINESTRING (0 0, 1 1, 2 2, 3 3)