aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/Geocode/Bing.pm
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2012-12-04 16:10:44 +0000
committerMatthew Somerville <matthew@mysociety.org>2012-12-04 16:10:44 +0000
commit93e01b6bf2017f308b85301016f16d7e3619b314 (patch)
tree931c9168347b4fe5e33374cf3de31604b40061a5 /perllib/FixMyStreet/Geocode/Bing.pm
parent429f5b61f56519914dd38c0e62d0709d4d380dee (diff)
Add Zurich geocoder (and allow geocoder choice to be picked in config).
Diffstat (limited to 'perllib/FixMyStreet/Geocode/Bing.pm')
-rw-r--r--perllib/FixMyStreet/Geocode/Bing.pm9
1 files changed, 8 insertions, 1 deletions
diff --git a/perllib/FixMyStreet/Geocode/Bing.pm b/perllib/FixMyStreet/Geocode/Bing.pm
index 18e6b56ce..85eef3d0f 100644
--- a/perllib/FixMyStreet/Geocode/Bing.pm
+++ b/perllib/FixMyStreet/Geocode/Bing.pm
@@ -15,14 +15,21 @@ use File::Path ();
use LWP::Simple;
use Digest::MD5 qw(md5_hex);
+use mySociety::Locale;
+
# string STRING CONTEXT
# Looks up on Bing Maps API, and caches, a user-inputted location.
# Returns array of (LAT, LON, ERROR), where ERROR is either undef, a string, or
# an array of matches if there are more than one. The information in the query
# may be used to disambiguate the location in cobranded versions of the site.
sub string {
- my ( $s, $c, $params ) = @_;
+ my ( $s, $c ) = @_;
+
+ my $params = $c->cobrand->disambiguate_location($s);
+
+ $s = FixMyStreet::Geocode::escape($s);
$s .= '+' . $params->{town} if $params->{town} and $s !~ /$params->{town}/i;
+
my $url = "http://dev.virtualearth.net/REST/v1/Locations?q=$s";
$url .= '&userMapView=' . join(',', @{$params->{bounds}})
if $params->{bounds};