diff --git a/server/map/__pycache__/get_relation.cpython-311.pyc b/server/map/__pycache__/get_relation.cpython-311.pyc index b358dc3736955c52454f2a9a260eaad50c0aa21b..fe7ed5abeb7016ab5d41377e8865cbfaade3f704 100644 Binary files a/server/map/__pycache__/get_relation.cpython-311.pyc and b/server/map/__pycache__/get_relation.cpython-311.pyc differ diff --git a/server/map/get_relation.py b/server/map/get_relation.py index a4de972437fc229a24221c51d59ebe598d0253c2..b63bc4292696cf1cd9d8492d881b72d63c77643b 100644 --- a/server/map/get_relation.py +++ b/server/map/get_relation.py @@ -112,16 +112,16 @@ def cut_polygon_in_two(polygon: Polygon, divisor: float, cell_size: float): if len(split_shape) > 2: # Get last point added to - last_point = split_shape[len(split_shape)-1] + last_point = split_shape[len(split_shape)-2] # Get length of the newly created edge - new_edge_len = last_point.x - split_shape[0].x - 0.0001 + 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 # Add points along the new edge to allow horizontal sections to be split into vertical ones while new_edge_len > cell_size: - print("Hit") - split_shape.append((new_edge_len-cell_size, last_point.y)) - remaining_shape.append((new_edge_len-cell_size, last_point.y)) + 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