aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/Geocode.pm
diff options
context:
space:
mode:
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;