uk_county_locator 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,316 @@
1
+ # frozen_string_literal: true
2
+
3
+ module UkCountyLocator
4
+ module Aliases
5
+ # rubocop:disable Metrics/ModuleLength
6
+ module HistoricCountyAliases
7
+ HISTORIC_COUNTY_ALIASES = {
8
+ 'Aber' => 'Aberdeenshire',
9
+ 'County of Aberdeen' => 'Aberdeenshire',
10
+ 'Siorrachd Obar Dheathain' => 'Aberdeenshire',
11
+ 'Obar Dheathain' => 'Aberdeenshire',
12
+ 'Angl' => 'Anglesey',
13
+ 'Ynys Mon' => 'Anglesey',
14
+ 'Ynys Môn' => 'Anglesey',
15
+ 'Sir Fôn' => 'Anglesey',
16
+ 'Sir Môn' => 'Anglesey',
17
+ 'Sir Fon' => 'Anglesey',
18
+ 'Sir Mon' => 'Anglesey',
19
+ 'Aonghas' => 'Angus',
20
+ 'County Antrim' => 'Antrim',
21
+ 'Co Antrim' => 'Antrim',
22
+ 'Contae Aontroma' => 'Antrim',
23
+ 'Aontroma' => 'Antrim',
24
+ 'Coontie Antrìm' => 'Antrim',
25
+ 'Argyll' => 'Argyllshire',
26
+ 'Argyle' => 'Argyllshire',
27
+ 'Earra-Ghàidheal' => 'Argyllshire',
28
+ 'Earra-Ghaidheal' => 'Argyllshire',
29
+ 'Co Armagh' => 'Armagh',
30
+ 'County Armagh' => 'Armagh',
31
+ 'Contae Ard Mhacha' => 'Armagh',
32
+ 'Ard Mhacha' => 'Armagh',
33
+ 'Coontie Airmagh' => 'Armagh',
34
+ 'Airmagh' => 'Armagh',
35
+ 'Coontie Armagh' => 'Armagh',
36
+ 'Ayr' => 'Ayrshire',
37
+ 'Siorrachd Inbhir Àir' => 'Ayrshire',
38
+ 'Inbhir Àir' => 'Ayrshire',
39
+ 'Inbhir Air' => 'Ayrshire',
40
+ 'Banff' => 'Banffshire',
41
+ 'Siorrachd Bhanbh' => 'Banffshire',
42
+ 'Bhanbh' => 'Banffshire',
43
+ 'Beds' => 'Bedfordshire',
44
+ 'Berks' => 'Berkshire',
45
+ 'Berwick' => 'Berwickshire',
46
+ 'Bhearaig' => 'Berwickshire',
47
+ 'Siorrachd Bhearaig' => 'Berwickshire',
48
+ 'Breconshire' => 'Brecknockshire',
49
+ 'Brecon' => 'Brecknockshire',
50
+ 'Brecknockshire' => 'Brecknockshire',
51
+ 'Brecknock' => 'Brecknockshire',
52
+ 'Brycheiniog' => 'Brecknockshire',
53
+ 'Sir Brycheiniog' => 'Brecknockshire',
54
+ 'Brecks' => 'Brecknockshire',
55
+ 'Bcshire' => 'Brecknockshire',
56
+ 'Brecs' => 'Brecknockshire',
57
+ 'Bucks' => 'Buckinghamshire',
58
+ 'Bute' => 'Buteshire',
59
+ 'Bhòid' => 'Buteshire',
60
+ 'Bhoid' => 'Buteshire',
61
+ 'Siorrachd Bhòid' => 'Buteshire',
62
+ 'Siorrachd Bhoid' => 'Buteshire',
63
+ 'County of Bute' => 'Buteshire',
64
+ 'Caerns' => 'Caernarfonshire',
65
+ 'Carnarvonshire' => 'Caernarfonshire',
66
+ 'Carnarvon' => 'Caernarfonshire',
67
+ 'Caernarvon' => 'Caernarfonshire',
68
+ 'Gaernarfon' => 'Caernarfonshire',
69
+ 'Sir Gaernarfon' => 'Caernarfonshire',
70
+ 'Carn' => 'Caernarfonshire',
71
+ 'Caith' => 'Caithness',
72
+ 'Gallaibh' => 'Caithness',
73
+ 'Cambs' => 'Cambridgeshire',
74
+ 'Cards' => 'Cardiganshire',
75
+ 'Cardigan' => 'Cardiganshire',
76
+ 'Sir Aberteifi' => 'Cardiganshire',
77
+ 'Aberteifi' => 'Cardiganshire',
78
+ 'Sir Ceredigion' => 'Cardiganshire',
79
+ 'Ceredigion' => 'Cardiganshire',
80
+ 'Carms' => 'Carmarthenshire',
81
+ 'Carmarthen' => 'Carmarthenshire',
82
+ 'Sir Gaerfyrddin' => 'Carmarthenshire',
83
+ 'Gaerfyrddin' => 'Carmarthenshire',
84
+ 'Ches' => 'Cheshire',
85
+ 'Clackm' => 'Clackmannanshire',
86
+ 'Siorrachd Chlach Mhanann' => 'Clackmannanshire',
87
+ 'Chlach Mhanann' => 'Clackmannanshire',
88
+ 'Corn' => 'Cornwall',
89
+ 'Cornw' => 'Cornwall',
90
+ 'Cumb' => 'Cumberland',
91
+ 'Denbigh' => 'Denbighshire',
92
+ 'Denbs' => 'Denbighshire',
93
+ 'Sir Ddinbych' => 'Denbighshire',
94
+ 'Ddinbych' => 'Denbighshire',
95
+ 'Derbs' => 'Derbyshire',
96
+ 'Dev' => 'Devon',
97
+ 'Dor' => 'Dorset',
98
+ 'County Down' => 'Down',
99
+ 'Co Down' => 'Down',
100
+ 'Contae an Dúin' => 'Down',
101
+ 'Contae an Duin' => 'Down',
102
+ 'Dúin' => 'Down',
103
+ 'Duin' => 'Down',
104
+ 'Coontie Doon' => 'Down',
105
+ 'Doon' => 'Down',
106
+ 'Countie Doun' => 'Down',
107
+ 'Doun' => 'Down',
108
+ 'Dumfries' => 'Dumfriesshire',
109
+ 'Siorrachd Dhùn Phris' => 'Dumfriesshire',
110
+ 'Dhùn Phris' => 'Dumfriesshire',
111
+ 'Dhun Phris' => 'Dumfriesshire',
112
+ 'Dunbar' => 'Dunbartonshire',
113
+ 'Siorrachd Dhùn Breatann' => 'Dunbartonshire',
114
+ 'Siorrachd Dhun Breatann' => 'Dunbartonshire',
115
+ 'Dhùn Breatann' => 'Dunbartonshire',
116
+ 'Dhun Breatann' => 'Dunbartonshire',
117
+ 'Durham' => 'County Durham',
118
+ 'Co Durham' => 'County Durham',
119
+ 'Co Dur' => 'County Durham',
120
+ 'Dur' => 'County Durham',
121
+ 'East Loth' => 'East Lothian',
122
+ 'E Lothian' => 'East Lothian',
123
+ 'E Loth' => 'East Lothian',
124
+ 'Lodainn an Ear' => 'East Lothian',
125
+ 'Fermanagh' => 'County Fermanagh',
126
+ 'Co Fermanagh' => 'County Fermanagh',
127
+ 'Contae Fhear Manach' => 'County Fermanagh',
128
+ 'Fhear Manach' => 'County Fermanagh',
129
+ 'Contae Fir Manach' => 'County Fermanagh',
130
+ 'Fir Manach' => 'County Fermanagh',
131
+ 'Coontie Fermanay' => 'County Fermanagh',
132
+ 'Fermanay' => 'County Fermanagh',
133
+ 'Fìobha' => 'Fife',
134
+ 'Fiobha' => 'Fife',
135
+ 'Flint' => 'Flintshire',
136
+ 'Flints' => 'Flintshire',
137
+ 'Sir y Fflint' => 'Flintshire',
138
+ 'Fflint' => 'Flintshire',
139
+ 'Glamorganshire' => 'Glamorgan',
140
+ 'Glam' => 'Glamorgan',
141
+ 'Sir Forgannwg' => 'Glamorgan',
142
+ 'Forgannwg' => 'Glamorgan',
143
+ 'Sir Morgannwg' => 'Glamorgan',
144
+ 'Morgannwg' => 'Glamorgan',
145
+ 'Glos' => 'Gloucestershire',
146
+ 'Gloucs' => 'Gloucestershire',
147
+ 'Hants' => 'Hampshire',
148
+ 'Here' => 'Herefordshire',
149
+ 'Heref' => 'Herefordshire',
150
+ 'Herts' => 'Hertfordshire',
151
+ 'Hunts' => 'Huntingdonshire',
152
+ 'Inver' => 'Inverness-shire',
153
+ 'Siorrachd Inbhir Nis' => 'Inverness-shire',
154
+ 'Inbhir Nis' => 'Inverness-shire',
155
+ 'Kincar' => 'Kincardineshire',
156
+ 'The Mearns' => 'Kincardineshire',
157
+ "A' Mhaoirne" => 'Kincardineshire',
158
+ 'Kinross' => 'Kinross-shire',
159
+ 'Ceann Rois' => 'Kinross-shire',
160
+ 'Kirkcud' => 'Kirkcudbrightshire',
161
+ 'Cille Chuithbeirt' => 'Kirkcudbrightshire',
162
+ 'Lanark' => 'Lanarkshire',
163
+ 'Siorrachd Lannraig' => 'Lanarkshire',
164
+ 'Lannraig' => 'Lanarkshire',
165
+ 'Lancs' => 'Lancashire',
166
+ 'Leics' => 'Leicestershire',
167
+ 'Lincs' => 'Lincolnshire',
168
+ 'Co Londonderry' => 'Londonderry',
169
+ 'County Londonderry' => 'Londonderry',
170
+ 'County Derry' => 'Londonderry',
171
+ 'Derry' => 'Londonderry',
172
+ 'Co Derry' => 'Londonderry',
173
+ 'Contae Dhoire' => 'Londonderry',
174
+ 'Dhoire' => 'Londonderry',
175
+ 'Coontie Lunnonderrie' => 'Londonderry',
176
+ 'Lunnonderrie' => 'Londonderry',
177
+ 'Merion' => 'Merionethshire',
178
+ 'Merioneth' => 'Merionethshire',
179
+ 'Sir Feirionnydd' => 'Merionethshire',
180
+ 'Feirionnydd' => 'Merionethshire',
181
+ 'Sir Meirionydd' => 'Merionethshire',
182
+ 'Meirionydd' => 'Merionethshire',
183
+ 'Sir Meirion' => 'Merionethshire',
184
+ 'Meirion' => 'Merionethshire',
185
+ 'Mx' => 'Middlesex',
186
+ 'Middx' => 'Middlesex',
187
+ 'Mddx' => 'Middlesex',
188
+ "M'sex" => 'Middlesex',
189
+ 'Midloth' => 'Midlothian',
190
+ 'Meadhan Lodainn' => 'Midlothian',
191
+ 'Mons' => 'Monmouthshire',
192
+ 'Mon' => 'Monmouthshire',
193
+ 'Monmouth' => 'Monmouthshire',
194
+ 'Monshire' => 'Monmouthshire',
195
+ 'Sir Fynwy' => 'Monmouthshire',
196
+ 'Fynwy' => 'Monmouthshire',
197
+ 'Sir Mynwy' => 'Monmouthshire',
198
+ 'Mynwy' => 'Monmouthshire',
199
+ 'Mont' => 'Montgomeryshire',
200
+ 'Montg' => 'Montgomeryshire',
201
+ 'Montgomery' => 'Montgomeryshire',
202
+ 'Sir Drefaldwyn' => 'Montgomeryshire',
203
+ 'Drefaldwyn' => 'Montgomeryshire',
204
+ 'Sir Maldwyn' => 'Montgomeryshire',
205
+ 'Maldwyn' => 'Montgomeryshire',
206
+ 'Moray' => 'Morayshire',
207
+ 'County of Moray' => 'Morayshire',
208
+ 'Moireibh' => 'Morayshire',
209
+ 'Nairn' => 'Nairnshire',
210
+ 'County of Nairn' => 'Nairnshire',
211
+ 'Siorrachd Inbhir Narann' => 'Nairnshire',
212
+ 'Inbhir Narann' => 'Nairnshire',
213
+ 'Norf' => 'Norfolk',
214
+ 'Northants' => 'Northamptonshire',
215
+ 'Northumb' => 'Northumberland',
216
+ 'Northd' => 'Northumberland',
217
+ 'Notts' => 'Nottinghamshire',
218
+ 'Orkney Islands' => 'Orkney',
219
+ 'Arcaibh' => 'Orkney',
220
+ 'Oxon' => 'Oxfordshire',
221
+ 'Peebles' => 'Peeblesshire',
222
+ 'Siorrachd nam Pùballan' => 'Peeblesshire',
223
+ 'Siorrachd nam Puballan' => 'Peeblesshire',
224
+ 'nam Pùballan' => 'Peeblesshire',
225
+ 'nam Puballan' => 'Peeblesshire',
226
+ 'Pembs' => 'Pembrokeshire',
227
+ 'Pem' => 'Pembrokeshire',
228
+ 'Pemb' => 'Pembrokeshire',
229
+ 'Pembroke' => 'Pembrokeshire',
230
+ 'Sir Benfro' => 'Pembrokeshire',
231
+ 'Benfro' => 'Pembrokeshire',
232
+ 'Sir Penfro' => 'Pembrokeshire',
233
+ 'Penfro' => 'Pembrokeshire',
234
+ 'Perth' => 'Perthshire',
235
+ 'Siorrachd Pheairt' => 'Perthshire',
236
+ 'Pheairt' => 'Perthshire',
237
+ 'Radnor' => 'Radnorshire',
238
+ 'Rad' => 'Radnorshire',
239
+ 'Rads' => 'Radnorshire',
240
+ 'Sir Raesyfed' => 'Radnorshire',
241
+ 'Raesyfed' => 'Radnorshire',
242
+ 'Sir Maesyfed' => 'Radnorshire',
243
+ 'Maesyfed' => 'Radnorshire',
244
+ 'Renfrew' => 'Renfrewshire',
245
+ 'Siorrachd Rinn Friù' => 'Renfrewshire',
246
+ 'Siorrachd Rinn Friu' => 'Renfrewshire',
247
+ 'Rinn Friù' => 'Renfrewshire',
248
+ 'Rinn Friu' => 'Renfrewshire',
249
+ 'Ross-shire and Cromartyshire' => 'Ross-shire & Cromartyshire',
250
+ 'Ross' => 'Ross-shire & Cromartyshire',
251
+ 'Crom' => 'Ross-shire & Cromartyshire',
252
+ 'Ross and Crom' => 'Ross-shire & Cromartyshire',
253
+ 'Ross & Crom' => 'Ross-shire & Cromartyshire',
254
+ 'Ross-shire' => 'Ross-shire & Cromartyshire',
255
+ 'Cromartyshire' => 'Ross-shire & Cromartyshire',
256
+ 'Siorrachd Rois' => 'Ross-shire & Cromartyshire',
257
+ 'Rois' => 'Ross-shire & Cromartyshire',
258
+ 'Siorrachd Chromba' => 'Ross-shire & Cromartyshire',
259
+ 'Chromba' => 'Ross-shire & Cromartyshire',
260
+ 'Roxb' => 'Roxburghshire',
261
+ 'Siorrachd Rosbroig' => 'Roxburghshire',
262
+ 'Rosbroig' => 'Roxburghshire',
263
+ 'Rutlandshire' => 'Rutland',
264
+ 'Rut' => 'Rutland',
265
+ 'Selk' => 'Selkirkshire',
266
+ 'Siorrachd Shalcraig' => 'Selkirkshire',
267
+ 'Shalcraig' => 'Selkirkshire',
268
+ 'Shetland Islands' => 'Shetland',
269
+ 'Zetland' => 'Shetland',
270
+ 'Sealtainn' => 'Shetland',
271
+ 'Shrops' => 'Shropshire',
272
+ 'Salop' => 'Shropshire',
273
+ 'Somersetshire' => 'Somerset',
274
+ 'Som' => 'Somerset',
275
+ 'Staffs' => 'Staffordshire',
276
+ 'Staf' => 'Staffordshire',
277
+ 'Stirl' => 'Stirlingshire',
278
+ 'Siorrachd Sruighlea' => 'Stirlingshire',
279
+ 'Sruighlea' => 'Stirlingshire',
280
+ 'Suff' => 'Suffolk',
281
+ 'Surr' => 'Surrey',
282
+ 'Sy' => 'Surrey',
283
+ 'Sx' => 'Sussex',
284
+ 'Ssx' => 'Sussex',
285
+ 'Suther' => 'Sutherland',
286
+ 'Cataibh' => 'Sutherland',
287
+ 'Co Tyrone' => 'County Tyrone',
288
+ 'Tyrone' => 'County Tyrone',
289
+ 'Tir Eoghain' => 'County Tyrone',
290
+ 'Tír Eoghain' => 'County Tyrone',
291
+ 'Contae Tír Eoghain' => 'County Tyrone',
292
+ 'Contae Tir Eoghain' => 'County Tyrone',
293
+ 'Coontie Owenslann' => 'County Tyrone',
294
+ 'Owenslann' => 'County Tyrone',
295
+ 'Warks' => 'Warwickshire',
296
+ 'War' => 'Warwickshire',
297
+ 'Warw' => 'Warwickshire',
298
+ 'W Lothian' => 'West Lothian',
299
+ 'West Loth' => 'West Lothian',
300
+ 'W Loth' => 'West Lothian',
301
+ 'Lodainn an Iar' => 'West Lothian',
302
+ 'Westm' => 'Westmorland',
303
+ 'Wigtown' => 'Wigtownshire',
304
+ 'Siorrachd Bhaile na h-Ùige' => 'Wigtownshire',
305
+ 'Siorrachd Bhaile na h-Uige' => 'Wigtownshire',
306
+ 'Bhaile na h-Ùige' => 'Wigtownshire',
307
+ 'Bhaile na h-Uige' => 'Wigtownshire',
308
+ 'Wilts' => 'Wiltshire',
309
+ 'Worcs' => 'Worcestershire',
310
+ 'Worsts' => 'Worcestershire',
311
+ 'Yorks' => 'Yorkshire'
312
+ }.freeze
313
+ end
314
+ # rubocop:enable Metrics/ModuleLength
315
+ end
316
+ end
@@ -0,0 +1,56 @@
1
+ # frozen_string_literal: true
2
+
3
+ module UkCountyLocator
4
+ # Class that encompasses all validations on user input
5
+ class ArgumentValidator
6
+ attr_reader :type, :lat, :lng, :county
7
+
8
+ VALID_COUNTY_TYPES = %i[current ceremonial historic].freeze
9
+
10
+ def initialize(request:, type:, lat: nil, lng: nil, county: nil)
11
+ @request = request
12
+ @type = verified_type(type)
13
+ @lat = parse_coordinate(lat, 'lat') if lat
14
+ @lng = parse_coordinate(lng, 'lat') if lat
15
+ @county = validated_county(county) if county
16
+ end
17
+
18
+ private
19
+
20
+ def verified_type(type)
21
+ type = type&.downcase&.to_sym
22
+ return type if valid_county_type?(type)
23
+
24
+ raise InvalidArgumentError, "Invalid input: type must be one of :current, :ceremonial, :historic.#{all_message}"\
25
+ ", got #{type}"
26
+ end
27
+
28
+ def valid_county_type?(type)
29
+ return true if type == :all && @request == :county
30
+
31
+ VALID_COUNTY_TYPES.include?(type)
32
+ end
33
+
34
+ def parse_coordinate(value, name)
35
+ if value.is_a?(String)
36
+ Float(value)
37
+ elsif value.is_a?(Numeric)
38
+ value.to_f
39
+ else
40
+ raise InvalidArgumentError, "Expected #{name} to be Numeric or a String, got #{value.class}"
41
+ end
42
+ rescue ArgumentError
43
+ raise InvalidArgumentError, "Invalid #{name} format: '#{value}'"
44
+ end
45
+
46
+ def validated_county(county)
47
+ return county if county.is_a?(String)
48
+
49
+ raise InvalidArgumentError, "Expected county to be a String, got #{county.class}"
50
+ end
51
+
52
+ def all_message
53
+ @request == :county ? ', or :all' : ''
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,63 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'polylines_service'
4
+ require_relative 'polygons/ceremonial_county_polygons'
5
+ require_relative 'polygons/historic_county_polygons'
6
+ require_relative 'polygons/current_county_and_unitary_authority_polygons'
7
+
8
+ module UkCountyLocator
9
+ # Locator is responsible for determining the county data (current, ceremonial, or historic)
10
+ # for a given latitude and longitude. It handles both general county data retrieval
11
+ # for all county types or specific retrieval based on a provided type. The class also
12
+ # integrates with the PolylinesService to check if the point lies within the defined county polygons.
13
+ class Locator
14
+ def initialize(lat, lng, type: :all)
15
+ @lat = lat
16
+ @lng = lng
17
+ @type = type
18
+ end
19
+
20
+ def county_data
21
+ return specific_county_type(@type) unless @type == :all
22
+
23
+ {
24
+ current_county_or_unitary_authority: find_county_within(current_county_and_unitary_authority_polygons),
25
+ ceremonial_county: find_county_within(ceremonial_county_polygons),
26
+ historic_county: find_county_within(historic_county_polygons)
27
+ }
28
+ end
29
+
30
+ private
31
+
32
+ def specific_county_type(county_type)
33
+ case county_type.downcase
34
+ when :current
35
+ find_county_within(current_county_and_unitary_authority_polygons)
36
+ when :ceremonial
37
+ find_county_within(ceremonial_county_polygons)
38
+ when :historic
39
+ find_county_within(historic_county_polygons)
40
+ end
41
+ end
42
+
43
+ def find_county_within(polygons)
44
+ polylines_service.point_inside_polygon?(polygons)
45
+ end
46
+
47
+ def polylines_service
48
+ @polylines_service ||= PolylinesService.new(lat: @lat, lng: @lng)
49
+ end
50
+
51
+ def current_county_and_unitary_authority_polygons
52
+ Polygons::CurrentCountyAndUnitaryAuthorityPolygons::CURRENT_COUNTY_AND_UNITARY_AUTHORITY_POLYGONS
53
+ end
54
+
55
+ def ceremonial_county_polygons
56
+ Polygons::CeremonialCountyPolygons::CEREMONIAL_COUNTY_POLYGONS
57
+ end
58
+
59
+ def historic_county_polygons
60
+ Polygons::HistoricCountyPolygons::HISTORIC_COUNTY_POLYGONS
61
+ end
62
+ end
63
+ end
@@ -0,0 +1,81 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'polygons/ceremonial_county_polygons'
4
+ require_relative 'polygons/historic_county_polygons'
5
+ require_relative 'polygons/current_county_and_unitary_authority_polygons'
6
+ require_relative 'aliases/ceremonial_county_aliases'
7
+ require_relative 'aliases/historic_county_aliases'
8
+ require_relative 'aliases/current_county_and_unitary_authority_aliases'
9
+
10
+ module UkCountyLocator
11
+ # The `UkCountyLocator::PolygonFetcher` retrieves geographic polygon data for UK counties.
12
+ # Supports `:current`, `:ceremonial`, and `:historic` county types.
13
+ # The class supports a large number of aliases for each county, stored in the aliases directory.
14
+ class PolygonFetcher
15
+ def initialize(type:)
16
+ @type = type
17
+ @counties = fetch_county_polygons.transform_keys(&:downcase)
18
+ end
19
+
20
+ def county_polygon(county)
21
+ county = county.downcase
22
+ return @counties[county] if @counties[county]
23
+ return @counties[county_by_alias(county)] if @counties[county_by_alias(county)]
24
+
25
+ nil
26
+ end
27
+
28
+ def county_list
29
+ fetch_county_polygons.keys.sort
30
+ end
31
+
32
+ private
33
+
34
+ def fetch_county_polygons
35
+ case @type
36
+ when :current
37
+ current_county_and_unitary_authority_polygons
38
+ when :ceremonial
39
+ ceremonial_county_polygons
40
+ when :historic
41
+ historic_county_polygons
42
+ end
43
+ end
44
+
45
+ def county_by_alias(county)
46
+ case @type
47
+ when :current
48
+ current_county_and_unitary_authority_aliases[county]&.downcase
49
+ when :ceremonial
50
+ ceremonial_county_aliases[county]&.downcase
51
+ when :historic
52
+ historic_county_aliases[county]&.downcase
53
+ end
54
+ end
55
+
56
+ def current_county_and_unitary_authority_polygons
57
+ Polygons::CurrentCountyAndUnitaryAuthorityPolygons::CURRENT_COUNTY_AND_UNITARY_AUTHORITY_POLYGONS
58
+ end
59
+
60
+ def ceremonial_county_polygons
61
+ Polygons::CeremonialCountyPolygons::CEREMONIAL_COUNTY_POLYGONS
62
+ end
63
+
64
+ def historic_county_polygons
65
+ Polygons::HistoricCountyPolygons::HISTORIC_COUNTY_POLYGONS
66
+ end
67
+
68
+ def current_county_and_unitary_authority_aliases
69
+ Aliases::CurrentCountyAndUnitaryAuthorityAliases::CURRENT_COUNTY_AND_UNITARY_AUTHORITY_ALIASES
70
+ .transform_keys(&:downcase)
71
+ end
72
+
73
+ def ceremonial_county_aliases
74
+ Aliases::CeremonialCountyAliases::CEREMONIAL_COUNTY_ALIASES.transform_keys(&:downcase)
75
+ end
76
+
77
+ def historic_county_aliases
78
+ Aliases::HistoricCountyAliases::HISTORIC_COUNTY_ALIASES.transform_keys(&:downcase)
79
+ end
80
+ end
81
+ end