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

[UK] May 2024 Boundary-Line import. #428

Merged
merged 1 commit into from
May 15, 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
25 changes: 25 additions & 0 deletions mapit_gb/controls/2024-05.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# A control file for importing May 2024 Boundary-Line.

from mapit.models import Area, Generation


def check(name, type, country, geometry, ons_code, commit, **args):
"""Should return True if this area is NEW, False if we should match against
an ONS code, or an Area to be used as an override instead."""

if type != 'CED':
return False

current = Generation.objects.current()
if not current: # Fresh import
return False

# All the unit IDs have changed in this release. CEDs don't have ONS codes
# to match on, so instead we have to match on name (they should all be the same)
area = Area.objects.get(
type__code='CED',
names__type__code='O', names__name=name,
generation_low__lte=current, generation_high__gte=current,
polygons__polygon__contains=geometry.geos.point_on_surface
)
return area
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def handle_label(self, filename, **options):
except Code.DoesNotExist:
ons_code = None
elif ons_code:
m = Area.objects.get(codes__type=code_version, codes__code=ons_code)
m = Area.objects.exclude(type__code='WMCF').get(codes__type=code_version, codes__code=ons_code)
elif unit_id:
m = Area.objects.get(
codes__type=code_type_os, codes__code=unit_id, generation_high=current_generation)
Expand Down Expand Up @@ -217,4 +217,7 @@ def patch_boundary_line(self, name, ons_code, unit_id, area_code):
if area_code == 'UTW' and name == 'An Taobh Siar agus Nis Ward' and ons_code == 'S13003134':
return {'ons-code': 'S13002608'}

if area_code == 'DIW' and name == 'Loughton Fairmead Ward' and ons_code == 'E05015731':
return {'ons-code': 'E05015730'}

return {}
Loading