Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RATYK-18: Make parent determination conditions less strict #65

Merged
merged 3 commits into from
May 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
### Fixed
- helsinki importer: Make tolerance for divisions extending past their parents relative to parent
area (from 300 m^2 to 0.1% of parent area)
- helsinki importer: Update `statistical_district` WFS layer value

## [0.3.10]
### Fixed
- Fix Helsinki importer urls
Expand Down
2 changes: 1 addition & 1 deletion munigeo/data/fi/helsinki/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ divisions:
no_parent_division: yes
parent_ocd_id: 'ocd-division/country:fi'
wfs_url: 'https://kartta.hsy.fi/geoserver/wfs?CQL_FILTER=kunta%20in%20(%27091%27,%27092%27,%27049%27,%27235%27)'
wfs_layer: 'taustakartat_ja_aluejaot:seutukartta_pien_2018'
wfs_layer: 'taustakartat_ja_aluejaot:seutukartta_pien_2021'
fields:
origin_id: kokotun
ocd_id: kokotun
Expand Down
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.0001:
continue
parents.append(parent)
if not parents:
Expand Down
Loading