append_line

Contents

append_line#

zeroheliumkit.src.utils.append_line(line1: LineString, line2: LineString, direction: float = None, ignore_crossing=False, chaining=True) LineString[source]#

Appends arbitrary line to another arbitrary line and Return the result.

Parameters:
  • line1 (LineString) – The original LineString.

  • line2 (LineString) – The LineString to be appended.

  • direction (float, optional) – The angle in degrees to rotate line2 before appending. Defaults to None.

  • ignore_crossing (bool, optional) – Whether to ignore crossing between line1 and line2. Defaults to False.

  • chaining (bool, optional) – Whether to chain line2 to the end of line1 or perform a union. Defaults to True.

Raises:

RouteError – If the appended line crosses the skeleton and ignore_crossing is False.

Example

>>> line1 = LineString([(0, 0), (1, 1), (2, 2)])
>>> line2 = LineString([(2, 2), (3, 3), (4, 4)])
>>> result = append_line(line1, line2, direction=45, ignore_crossing=True, chaining=False)
>>> print(result)
    LINESTRING (0 0, 1 1, 2 2, 3 3, 4 4)