Skip to content

Commit

Permalink
fix(helsinki): loosen parent determination conditions
Browse files Browse the repository at this point in the history
Use relative values rather than absolute values.
  • Loading branch information
danipran committed Apr 16, 2024
1 parent f3ea307 commit 2f3fb02
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions munigeo/importer/helsinki.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 2f3fb02

Please sign in to comment.