aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/Geocode/Bing.pm
diff options
context:
space:
mode:
Diffstat (limited to 'perllib/FixMyStreet/Geocode/Bing.pm')
-rw-r--r--perllib/FixMyStreet/Geocode/Bing.pm14
1 files changed, 3 insertions, 11 deletions
diff --git a/perllib/FixMyStreet/Geocode/Bing.pm b/perllib/FixMyStreet/Geocode/Bing.pm
index 3bbb9dcdc..18e6b56ce 100644
--- a/perllib/FixMyStreet/Geocode/Bing.pm
+++ b/perllib/FixMyStreet/Geocode/Bing.pm
@@ -24,7 +24,7 @@ sub string {
my ( $s, $c, $params ) = @_;
$s .= '+' . $params->{town} if $params->{town} and $s !~ /$params->{town}/i;
my $url = "http://dev.virtualearth.net/REST/v1/Locations?q=$s";
- $url .= '&userMapView=' . $params->{bounds}[0] . ',' . $params->{bounds}[1]
+ $url .= '&userMapView=' . join(',', @{$params->{bounds}})
if $params->{bounds};
$url .= '&userLocation=' . $params->{centre} if $params->{centre};
$url .= '&c=' . $params->{bing_culture} if $params->{bing_culture};
@@ -52,15 +52,11 @@ sub string {
}
my $results = $js->{resourceSets}->[0]->{resources};
- my ( $error, @valid_locations, $latitude, $longitude, $ni );
+ my ( $error, @valid_locations, $latitude, $longitude );
foreach (@$results) {
my $address = $_->{name};
- next unless $_->{address}->{countryRegion} eq $params->{bing_country};
- if ($params->{bing_country} eq 'United Kingdom' && $_->{address}{adminDistrict} eq 'Northern Ireland') {
- $ni = 1;
- next;
- }
+ next if $params->{bing_country} && $_->{address}->{countryRegion} ne $params->{bing_country};
# Getting duplicate, yet different, results from Bing sometimes
next if @valid_locations
@@ -82,10 +78,6 @@ sub string {
push (@valid_locations, $_);
}
- if ($ni && !scalar @valid_locations) {
- return { error => _("We do not currently cover Northern Ireland, I'm afraid.") };
- }
-
return { latitude => $latitude, longitude => $longitude } if scalar @valid_locations == 1;
return { error => $error };
}