Skip to content

Commit

Permalink
streamline counting
Browse files Browse the repository at this point in the history
  • Loading branch information
martinfleis committed Jun 27, 2024
1 parent 8e5bf56 commit a6fcacb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions momepy/coins.py
Original file line number Diff line number Diff line change
Expand Up @@ -401,15 +401,15 @@ def _angle_between_two_lines(line1, line2):
points = Counter([a, b, c, d])

# make sure lines are not identical
if Counter(points.values()) == {2: 2}:
if len(points) == 2:
raise ValueError(
"Lines are identical. Please revise input data "
"to ensure no lines are identical or overlapping. "
"You can check for duplicates using `gdf.geometry.duplicated()`."
)

# make sure lines do touch
if Counter(points.values()) == {1: 4}:
if len(points) == 4:
raise ValueError("Lines do not touch.")

# points where line touch = "origin" (for vector-based angle calculation)
Expand Down

0 comments on commit a6fcacb

Please sign in to comment.