Last night
This commit is contained in:
parent
2906b01734
commit
42ee2d4c51
47 changed files with 848 additions and 478 deletions
|
|
@ -75,6 +75,9 @@ def compute_voronoi_regions(
|
|||
n_real = len(pts)
|
||||
pc_polys: dict[str, list[Polygon]] = defaultdict(list)
|
||||
|
||||
if not boundary.is_valid:
|
||||
boundary = make_valid(boundary)
|
||||
|
||||
for i in range(n_real):
|
||||
region_idx = vor.point_region[i]
|
||||
region = vor.regions[region_idx]
|
||||
|
|
@ -100,6 +103,8 @@ def _equal_split_fallback(
|
|||
postcodes: list[str], boundary: Polygon | MultiPolygon
|
||||
) -> dict[str, Polygon | MultiPolygon]:
|
||||
"""Split boundary into roughly equal horizontal strips, one per postcode."""
|
||||
if not boundary.is_valid:
|
||||
boundary = make_valid(boundary)
|
||||
min_x, min_y, max_x, max_y = boundary.bounds
|
||||
n = len(postcodes)
|
||||
result = {}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue