diff options
author | Matthew Somerville <matthew@mysociety.org> | 2011-06-29 16:32:39 +0100 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2011-06-29 22:44:06 +0100 |
commit | 00567425ca491a8fc69770246357a4569f450455 (patch) | |
tree | d21f5a1e52be26af070c0db12be62b099aeb797f | |
parent | c280404d39709f01005d9292546762f3802c7bf3 (diff) |
Skip non-UK results in Bing geocoder, remove some geocode tests.
-rw-r--r-- | perllib/FixMyStreet/Geocode.pm | 2 | ||||
-rw-r--r-- | t/app/controller/around.t | 25 |
2 files changed, 1 insertions, 26 deletions
diff --git a/perllib/FixMyStreet/Geocode.pm b/perllib/FixMyStreet/Geocode.pm index 64e8e567d..286a10105 100644 --- a/perllib/FixMyStreet/Geocode.pm +++ b/perllib/FixMyStreet/Geocode.pm @@ -185,8 +185,8 @@ sub string_bing { my ( $error, @valid_locations, $latitude, $longitude ); foreach (@$results) { my $address = $_->{name}; + next unless $_->{address}->{countryRegion} eq 'United Kingdom'; # FIXME This is UK only ( $latitude, $longitude ) = @{ $_->{point}->{coordinates} }; - # TODO Check $_->{address}->{countryRegion} for cobrand push (@$error, $address); push (@valid_locations, $_); } diff --git a/t/app/controller/around.t b/t/app/controller/around.t index ba0dfe1b4..0060e957c 100644 --- a/t/app/controller/around.t +++ b/t/app/controller/around.t @@ -41,21 +41,6 @@ foreach my $test ( pc_alternatives => [], }, { - pc => 'glenthorpe', - errors => [], - pc_alternatives => [ - 'Glenthorpe Crescent, Leeds LS9 7', - 'Glenthorpe Rd, Merton, Greater London SM4 4', - 'Glenthorpe Ave, Leeds LS9 7', - 'Glenthorne Rd, Hammersmith, Greater London W6 0', - 'Glenthorne Ave, Yeovil, Somerset BA21 4', - 'Glenthorne Rd, Kenwyn, Cornwall TR3 6', - 'Glenthorne Dr, Cheslyn Hay, Staffordshire WS6 7', - 'Glenthorne Gardens, Ilford, Greater London IG5 0', - 'Glenthorne Ave, Croydon, Greater London CR0 7', - ], - }, - { pc => 'Glenthorpe Ct, Katy, TX 77494, USA', errors => ['Sorry, we could not find that location.'], @@ -81,16 +66,6 @@ foreach my $test ( latitude => '51.50101', longitude => '-0.141587', }, - { - pc => 'Manchester', - latitude => '53.480713', - longitude => '-2.234376', - }, - { - pc => 'Glenthorpe Rd, Merton, Greater London SM4 4, UK', - latitude => '51.3938', - longitude => '-0.22096', - }, ) { subtest "check lat/lng for '$test->{pc}'" => sub { |