aboutsummaryrefslogtreecommitdiffstats
path: root/t/Mock/MapIt.pm
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2019-04-01 10:54:15 +0100
committerMatthew Somerville <matthew-github@dracos.co.uk>2019-04-04 17:50:55 +0100
commitbcfd55500b9e4546a3951079285e85d2e9cf4995 (patch)
treeee79729d1834cd8a2e4764d3cb57bae13ef08d74 /t/Mock/MapIt.pm
parent98e61f99be442523fdfb38e95d9a8c2132ea0405 (diff)
[UK] Deal with 2019 local government changes.
Diffstat (limited to 't/Mock/MapIt.pm')
-rw-r--r--t/Mock/MapIt.pm10
1 files changed, 7 insertions, 3 deletions
diff --git a/t/Mock/MapIt.pm b/t/Mock/MapIt.pm
index d5b73641a..11fa4200c 100644
--- a/t/Mock/MapIt.pm
+++ b/t/Mock/MapIt.pm
@@ -30,7 +30,6 @@ my @PLACES = (
[ 'SL9 0NX', 51.615559, -0.556903, 2217, 'Buckinghamshire County Council', 'CTY', 2257, 'Chiltern District Council', 'DIS' ],
[ 'SW1A 1AA', 51.501009, -0.141588, 2504, 'Westminster City Council', 'LBO' ],
[ 'GL50 2PR', 51.896268, -2.093063, 2226, 'Gloucestershire County Council', 'CTY', 2326, 'Cheltenham Borough Council', 'DIS', 4544, 'Lansdown', 'DIW', 143641, 'Lansdown and Park', 'CED' ],
- [ '?', 51.754926, -1.256179, 2237, 'Oxfordshire County Council', 'CTY', 2421, 'Oxford City Council', 'DIS' ],
[ 'OX20 1SZ', 51.754926, -1.256179, 2237, 'Oxfordshire County Council', 'CTY', 2421, 'Oxford City Council', 'DIS' ],
[ 'OX16 9UP', 52.038712, -1.346397, 2237, 'Oxfordshire County Council', 'CTY', 2419, 'Cherwell District Council', 'DIS', 151767, "Banbury, Calthorpe & Easington", "DIW" ],
[ 'RG9 6TL', 51.561705, -0.868388, 2217, 'Buckinghamshire County Council', 'CTY'],
@@ -39,6 +38,7 @@ my @PLACES = (
[ 'BR1 3UH', 51.4021, 0.01578, 2482, 'Bromley Council', 'LBO' ],
[ 'BR1 3UH', 51.402096, 0.015784, 2482, 'Bromley Council', 'LBO' ],
[ '?', 50.78301, -0.646929 ],
+ [ 'TA1 1QP', 51.023569, -3.099055, 2239, 'Somerset County Council', 'CTY', 2429, 'Taunton Deane Borough Council', 'DIS' ],
[ 'GU51 4AE', 51.279456, -0.846216, 2333, 'Hart District Council', 'DIS', 2227, 'Hampshire County Council', 'CTY' ],
[ 'WS1 4NH', 52.563074, -1.991032, 2535, 'Sandwell Borough Council', 'MTD' ],
[ 'OX28 4DS', 51.784721, -1.494453 ],
@@ -72,14 +72,18 @@ sub dispatch_request {
return $self->output($response);
},
- sub (GET + /point/**.*) {
- my ($self, $point) = @_;
+ sub (GET + /point/**.* + ?*) {
+ my ($self, $point, $query) = @_;
foreach (@PLACES) {
if ($point eq "4326/$_->[2],$_->[1]") {
my %out;
for (my $i=3; $i<@$_; $i+=3) {
$out{"$_->[$i]"} = { id => $_->[$i], name => $_->[$i+1], type => $_->[$i+2] };
}
+ if ($query->{type}) {
+ my %types = map { $_ => 1 } split ',', $query->{type};
+ %out = map { $_ => $out{$_} } grep { $types{$out{$_}{type}} } keys %out;
+ }
return $self->output(\%out);
}
}