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|Ns?z3zw9Nx~cXoOl@dHV5)#F)|8H-ovXjS&UCrS+GP9qy&Of zn3pj!Fsx>T@E8~v8B!Q(Stn29v*l#*d&$hez))o~S)Si;GA}>(WLf_Ej9Qcb@;{&a wPe7CDE5~LR!M%)(m7AG_xtKJS7_Ante_&8zwA!EwrVfOFDRjbTvZ<&607(ZbMgRZ+ delta 237 zcmdn3`BaN<IWI340|NuYNA(Y>$|4*2oOl@PHV5)#F)|8G-ovZJlqWs;0*@p!OA7Pk zi%e3J@A0ZK3zY~?p3f-7#mJDtP|KPpUBf!rfmfWF6{<vy&z6yOatfaddl3@@14EU= z<QzW3$+!8|Fvd^r;D0XF!To?k_&SHwB@U?>)(Z;f*j?n%y27D#fkSI@zJR7|2mb>O z@#`FNmpJ5R)UPPKB5!z+!{`c!(FG2puWXxV3G8KLtl1nP#Kokk%4oHK{R4w4qtymg QFm)gVOraA&le<L>0GMw^<p2Nx 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