From 2f3fb026fef98f16deed4dfb7f4ad72f039b9eb2 Mon Sep 17 00:00:00 2001 From: Daniel Prange Date: Mon, 29 Jan 2024 15:06:19 +0200 Subject: [PATCH] fix(helsinki): loosen parent determination conditions Use relative values rather than absolute values. --- munigeo/importer/helsinki.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/munigeo/importer/helsinki.py b/munigeo/importer/helsinki.py index f6bee29..1f465f8 100644 --- a/munigeo/importer/helsinki.py +++ b/munigeo/importer/helsinki.py @@ -133,8 +133,11 @@ def _import_division(self, muni, div, type_obj, syncher, parent_dict, feat): parent_geom = parent.geometry.boundary if not geom.intersects(parent_geom): continue - area = (geom - parent.geometry.boundary).area - if area > 1e-6: + # Difference = how much of the area is outside the parent area + area_difference = (geom - parent_geom).area + # The areas must overlap by at least 99.99%, + # i.e. the difference must be less than 0.01%. + if area_difference / geom.area > 0.01: continue parents.append(parent) if not parents: