From 1fef2ffabff3f2c809f53d2a4862875aab878d78 Mon Sep 17 00:00:00 2001 From: Sara <sarasdj@stud.ntnu.no> Date: Tue, 12 Mar 2024 11:25:35 +0100 Subject: [PATCH] update: minor improvement to splitting --- .../__pycache__/get_relation.cpython-311.pyc | Bin 5477 -> 5307 bytes server/map/get_relation.py | 5 +---- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/server/map/__pycache__/get_relation.cpython-311.pyc b/server/map/__pycache__/get_relation.cpython-311.pyc index 5c05e2e26388e10266f5a9b6247b53d327a24bbb..9f6bc3bbed6c8498228339e917a9df921d086870 100644 GIT binary patch delta 173 zcmaE=wOf;KIWI340}#~fen_1pyphj|hmmh{AWs$}qu}H{yh@YB_*9hzO9VkmARvW# z86yM3Y9NLHMurrITGq+a_-r{@{9ZBx1*>c(%kvvf=H=&}EX#kNQET#F{^yhb31~8X q<=E^ZxR;T!ax;@K7n7zEqtycT4-7zRgDRLh5CW#q37^TPq6Pp-2P#GY delta 237 zcmdn3`BaN<IWI340}y;v|B$LIvXRe;hp}#RAWs$}qtN6%yh==Y(vvUnNHVjeFi*b7 zBsKXSuPU=piQwe<j8a^T3@Hq?ta;Kktdkvh#hF>5O4Rsl8CfT%@VT%TF#!#(a+sXM zXE^yb-x|jF$sPR9r8>ADa0p-Lkh;VnHN$#A;T*e*99ma6v@URHP0kn4l<nYuz#)E} zL+%oX+>H7ag;(SaFLD@N;V`<uVf2-4^DKeAjEps#BZRn^G*ua`7O;O{08$%N!PJ2e NFojM8P3{&k005Y8M&$qi diff --git a/server/map/get_relation.py b/server/map/get_relation.py index 8e240247..d6369636 100644 --- a/server/map/get_relation.py +++ b/server/map/get_relation.py @@ -106,15 +106,12 @@ def cut_polygon_in_two(polygon: Polygon, divisor: float, horizontal: bool): if len(split_shape) < 3: print("Not enough coordinates to create valid polygons: Split shape") split_shape = None - else: - split_shape.append(split_shape[0]) # NB: may not be necessary? # Check if the remaining_shape has enough coordinates to create a polygon if len(remaining_shape) < 3: print("Not enough coordinates to create valid polygons: Remaining shape") remaining_shape = None - else: - remaining_shape.append(remaining_shape[0]) + # Return split polygons as Shapely Polygon objects return Polygon(split_shape), Polygon(remaining_shape) -- GitLab