From 09ba20748babfb07656983efa0d6cc7c87a19ca6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albert=20Gallego=20Jim=C3=A9nez?= <91949040+AlbertGallegoJimenez@users.noreply.github.com> Date: Thu, 2 May 2024 18:00:43 +0200 Subject: [PATCH] multiple intersections bug fixed More info about the bug in the corresponding issue in the repo. --- .../computeIntersections.cpython-39.pyc | Bin 6035 -> 5849 bytes src/tools/computeIntersections.py | 16 ++++------------ .../intersect_lines.cpython-39.pyc | Bin 5341 -> 5341 bytes 3 files changed, 4 insertions(+), 12 deletions(-) diff --git a/src/tools/__pycache__/computeIntersections.cpython-39.pyc b/src/tools/__pycache__/computeIntersections.cpython-39.pyc index 9838d483fca2827ff8108d9e31b4d6974bf0cace..813e701396e0607a2b9c7aa22be8bc5bb31d18b9 100644 GIT binary patch delta 532 zcmaKpO=}ZT6o${a6Ou8_OmAkUlT0RQT`7f%U%Qfpi!Q`f7gj0QFSu<@ER`mMt1}jf zU^k_K3xc~Dck0HH+CSj7;KqfnbglF+l%5$7ghKD-yqt64eK`+T-~4&QUbCz+@HzN$ zcVqe5p}k(VTRdLjGPwG3^s4+0cO#=KlPZ~1+yhnFG*WT!HkRZiP6~6dL{CIqkDaJS zPE;R=q38*6`29{CsH(DG0|i}o4hE<&fY>FOcvR1NR>A6WA|ecN=VW_EIl066&#`-% z<>)aevj7Dc7zo?WZ5WFF{ab+fU1WU&8>n0kH6tSlsE}f|O59*5tJ@%R52(P^P@Xc? z#C{1O!X%^;6;lyg8TwYzBvVzWsK#^lN6apn?_L~6E#>F?h8fR4MviZiMPWu4Kr%_q z6nQe*!0b~L=Coqxz4riL>QirCmVA_0K~s2Q((puEFHZc%?|RnXDt5EH RXL_kt(_j4%U+7={(K#9}gIWLp delta 743 zcmZ`%O=}ZT6n%FlPN!*-PA8KzlTP!YZDSYW2jW5sy6DQ4pi~8G3B2i-aZF~Wf^wg+ zq+ltEfmsQHGcMgpTmcl7CIhc%4GTEvW0kA%F_MPH^cQ1T-Qwt|hMP--q%$giYPhJYmx3Fu3 z(-BL^AJK42=rmkUhD)xGIt@K5ruhWV?J%6)%rDZv!{H*2T4-PiEt4f;e(y*S=81kN zN$Q+&PIEo!)DPvLrOr$nSYk^$+u6 zqPsfu_Qx~P*D#CKVeBRgk6`%+vY5eY;#%&^{3BiV@Nel{y~O4x?^&1E?b_g3 z_9MU`Xpe8e8$vVqG2VxF!H)J}>=Qi`cY$Djc5q{24CW5GO=r!H<(BQlO0(Uz9UhO` z&ekp4ZTfbs+-bJ9Y%f^Xm!Lj)uQy;S?XBN-?UkGMT`!gi-J?Vo!%7Sr!O#2!*bB}X w7cC_P8f2&}sVo=4puH*?(wuBai@|f_D|`ta6k3Wq)Z+!;3#Z_IFk5{63uFzt4FCWD diff --git a/src/tools/computeIntersections.py b/src/tools/computeIntersections.py index a977167..8ac5f5e 100644 --- a/src/tools/computeIntersections.py +++ b/src/tools/computeIntersections.py @@ -159,31 +159,23 @@ def execute(self, parameters, messages): create_new_fields(shoreOutFeature, fields_to_add, data_type) """ - Get the keys of shorePoints (dictionary). The keys are tuples with the ids of the transects and shorelines. + Iterate over the shorePoints (dictionary). The keys are tuples with the ids of the transects and shorelines. If the value is a list, add the key as many times as the length of the list (to match the number of geometries with the number of ids). """ - shore_keys = [] - for key, value in shorePoints.items(): - if isinstance(value, list): # The intersection point is a list of points (MultiPoint) - for _ in range(len(value)): - shore_keys.append((key[0], key[1])) - else: - shore_keys.append((key[0], key[1])) - # Fill with the geometries (intersection points) and the transect_id and shore_id with arcpy.da.InsertCursor(shoreOutFeature, [transectsID, shoreID, "SHAPE@"]) as cursor: - for i, point in enumerate(shorePoints.values()): + for t_id_shore_id, point in shorePoints.items(): if isinstance(point, list): # The intersection point is a list of points (MultiPoint) for part in point: # Create the arcgis point arc_Point = [arcpy.Point(coord[0], coord[1]) for coord in part.coords][0] # Insert the row with the transect_id and shore_id and the point - cursor.insertRow([shore_keys[i][0], shore_keys[i][1], arc_Point]) + cursor.insertRow([t_id_shore_id[0], t_id_shore_id[1], arc_Point]) else: # Create the arcgis point arc_Point = [arcpy.Point(coord[0], coord[1]) for coord in point.coords][0] # Insert the row with the transect_id and shore_id and the point - cursor.insertRow([shore_keys[i][0], shore_keys[i][1], arc_Point]) + cursor.insertRow([t_id_shore_id[0], t_id_shore_id[1], arc_Point]) # Add the other fields of the Polyline Shorelines Feature Class # Get the fields to join diff --git a/src/tools/utils/__pycache__/intersect_lines.cpython-39.pyc b/src/tools/utils/__pycache__/intersect_lines.cpython-39.pyc index c9b9a7a1430291872427c5c3e8c53297e86a7ed2..69551650d5f3a33461fe5668c5d542bb58cf4aff 100644 GIT binary patch delta 20 acmcbsc~_G=k(ZZ?0SL})G2Y01Ndy2sL9R&aY