aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/Geocode.pm
diff options
context:
space:
mode:
authorStruan Donald <struan@exo.org.uk>2012-08-22 10:57:10 +0100
committerStruan Donald <struan@exo.org.uk>2012-08-22 10:57:10 +0100
commit2e0a4e8ec45579e4e5c9cf8aa123d5ab215b9703 (patch)
treec13e3c59b686e01460dc7960547f7e9c53c288bd /perllib/FixMyStreet/Geocode.pm
parentb99c5ff97b29a27eeba52ed24385ac30388e875c (diff)
parent88a7d38dffa3dabdf0f85573b254cea9c8ab232b (diff)
Merge remote-tracking branch 'origin/master' into fmb-read-only
Conflicts: .gitignore bin/make_css conf/general.yml-example perllib/FixMyStreet/App/Controller/Council.pm perllib/FixMyStreet/App/Controller/Report/New.pm perllib/FixMyStreet/Cobrand/Default.pm templates/web/default/around/around_index.html templates/web/default/index.html templates/web/emptyhomes/index.html templates/web/fixmystreet/around/around_index.html templates/web/fixmystreet/index.html web/fixmystreet_app_cgi.cgi web/fixmystreet_app_fastcgi.cgi
Diffstat (limited to 'perllib/FixMyStreet/Geocode.pm')
-rw-r--r--perllib/FixMyStreet/Geocode.pm14
1 files changed, 8 insertions, 6 deletions
diff --git a/perllib/FixMyStreet/Geocode.pm b/perllib/FixMyStreet/Geocode.pm
index 6ee17029a..f92e9cc9a 100644
--- a/perllib/FixMyStreet/Geocode.pm
+++ b/perllib/FixMyStreet/Geocode.pm
@@ -12,13 +12,13 @@ use strict;
use URI::Escape;
use FixMyStreet::Geocode::Bing;
use FixMyStreet::Geocode::Google;
+use FixMyStreet::Geocode::OSM;
# lookup STRING CONTEXT
# Given a user-inputted string, try and convert it into co-ordinates using either
# MaPit if it's a postcode, or some web API otherwise. Returns an array of
-# data, including an error if there is one (which includes a location being in
-# Northern Ireland). The information in the query may be used by cobranded versions
-# of the site to diambiguate locations.
+# data, including an error if there is one. The information in the query may be
+# used by cobranded versions of the site to diambiguate locations.
sub lookup {
my ($s, $c) = @_;
my $data = $c->cobrand->geocode_postcode($s);
@@ -38,11 +38,13 @@ sub string {
$s =~ s/\s+/ /g;
$s = URI::Escape::uri_escape_utf8($s);
$s =~ s/%20/+/g;
- my $params = $c->cobrand->disambiguate_location();
+ my $params = $c->cobrand->disambiguate_location($s);
return FixMyStreet::Geocode::Bing::string($s, $c, $params)
if FixMyStreet->config('BING_MAPS_API_KEY');
- # Fall back to Google API, which allow acces with and without a key
- return FixMyStreet::Geocode::Google::string($s, $c, $params);
+ # Fall back to Google API, which allow access with and without a key
+ return FixMyStreet::Geocode::Google::string($s, $c, $params)
+ if FixMyStreet->config('GOOGLE_MAPS_API_KEY');
+ return FixMyStreet::Geocode::OSM::string($s, $c, $params);
}
1;