Skip to content

Commit

Permalink
fix parsing points
Browse files Browse the repository at this point in the history
  • Loading branch information
martvanrijthoven committed Sep 25, 2023
1 parent 77d47c8 commit 92e43cc
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions wholeslidedata/annotation/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,11 @@ def _get_geometry(
if isinstance(coordinates, dict):
holes = coordinates["holes"]
coordinates = coordinates["coordinates"]
if len(coordinates) == 2 or (len(coordinates) == 1 and len(coordinates[0]) == 2):
return geometry.Point(coordinates)
if len(coordinates) <= 1:
raise InvalidCoordinatesError(f"Coordinates {coordinates} are not valid.")
if len(coordinates) == 2:
return geometry.Point(coordinates)

return geometry.Polygon(coordinates, holes).simplify(2.0)


Expand Down

0 comments on commit 92e43cc

Please sign in to comment.