From 592f0b7333ab96b8cf819ff72c44dd4bd330e1ee Mon Sep 17 00:00:00 2001 From: Sara <sarasdj@stud.ntnu.no> Date: Tue, 12 Mar 2024 17:53:41 +0100 Subject: [PATCH] update: more minor progress, still no proper split --- .../__pycache__/get_relation.cpython-311.pyc | Bin 6562 -> 6656 bytes server/map/get_relation.py | 14 ++++++++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/server/map/__pycache__/get_relation.cpython-311.pyc b/server/map/__pycache__/get_relation.cpython-311.pyc index fe7ed5abeb7016ab5d41377e8865cbfaade3f704..c02d4b335fff30f0ab474427196c1571b4382e6a 100644 GIT binary patch delta 436 zcmZ2v++f1DoR^o20SFvAKBT%xZ{+*N%f$`kG6V7F8<Y9?ycqvY_7%{a+{8D5bwLeF z3iD)h{@75K8jcj!8m1Js8uly>kaiGAVF$`HN<uh55+Sn;sAe@>9V0^xM-5Xp3rJy+ z7l>U2bV4oX<b(X3j9!zy1vWEsO#UyB2qY5)8wEN2ikN^ZUxJDMKrs28prS^Vpn`%z zPGWIMd_jI@UWs0Xl|q#$P^h>dC$l8JI3uwjHQFFnuVON<&^1QS$xno4u`CFhBR_e9 zuvXZGfaD9Q`Bzd4KQJ(qGWsw9DL<x25EaD~&GZGti-AyaOdlB-c;i7FAPH0eBH0*( z<rhd^64JULq;*3=WkKad34;l&4<_Fhwv>7xAhUq;qJZWEo)5f8%6@zh+N>wS&&)Vy uvz@pJBV+R9VhIbzvdL>C=4x6nS}kDzzyPE+sDh~ju3!qCsF++NX#fDil6iCh delta 332 zcmZoLS!B$&oR^o20SL~vd`R6OwUO@|FBcn-%M8SyFHGj+^J4rpIg)QD^PC!%$#41O zSgL@kCyVpP8Zy^#q_EU5En{I|SPjGwz{pU;QNsjMQ_BfrWrJmkTx(bsa7{iaATn86 zKzTBYfFHAKo)^$q&B=8F9gM7#*##4UWTs#v51U^R6VRxaAY$@wLB+{#LRT1-CQA#? z5?UI(Li(br=@nJe4T%?3&96vWOx`K1rFfCY{|b-)1s?w!A_@y6FN$b&xPD+`5SCvc zc}Ym?f{@mY$(ACPQa1!-7I0n^(44^YfgMTm#|NIxJtF+fjI%b+5jSCEOqzUA!h*4M hGMD6BO*2NT1?(RffYb(6Fm=EcOraAclP^db001K=U)%ry diff --git a/server/map/get_relation.py b/server/map/get_relation.py index b63bc429..7f59fd80 100644 --- a/server/map/get_relation.py +++ b/server/map/get_relation.py @@ -105,23 +105,25 @@ def cut_polygon_in_two(polygon: Polygon, divisor: float, cell_size: float): if cell_size > 0: # Horizontal split for point in exterior_coords: point = Point(point) # Convert coordinates to Shapely Point object - if point.y < divisor: - split_shape.append(point) + if point.y < divisor: # Check if point is over or below divisor + split_shape.append(point) # Append to appropriate shape else: remaining_shape.append(point) if len(split_shape) > 2: # Get last point added to - last_point = split_shape[len(split_shape)-2] + last_point = split_shape[-1] # Get length of the newly created edge new_edge_len = abs(last_point.x - split_shape[0].x) - print("new_edge_len: ", new_edge_len, " cell_size: ", cell_size) - x_val = new_edge_len-cell_size + print("new_edge_len: ", new_edge_len, " cell_size: ", cell_size, " last_point.x: ", last_point.x, " split_shape[0].x: ", split_shape[0].x) # Add points along the new edge to allow horizontal sections to be split into vertical ones while new_edge_len > cell_size: - split_shape.insert(0, (x_val, last_point.y)) # NB may have to add/subtract small offset of 0.00001 + x_val = new_edge_len - cell_size + + split_shape.insert(0, (x_val, last_point.y)) # NB may have to add/subtract small offset of 0.00001 remaining_shape.insert(0, (x_val, last_point.y)) # Prepend + new_edge_len -= cell_size else: # Vertical split -- GitLab