From 0000afc1f4b28c96365981fc24437a6983ee7ea2 Mon Sep 17 00:00:00 2001 From: Matthew Somerville Date: Fri, 13 Jul 2012 15:12:06 +0100 Subject: Add Nominatim-based geocoding service (fixes #183). --- perllib/FixMyStreet/Geocode.pm | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'perllib/FixMyStreet/Geocode.pm') diff --git a/perllib/FixMyStreet/Geocode.pm b/perllib/FixMyStreet/Geocode.pm index 6ee17029a..e5983810b 100644 --- a/perllib/FixMyStreet/Geocode.pm +++ b/perllib/FixMyStreet/Geocode.pm @@ -12,6 +12,7 @@ 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 @@ -41,8 +42,10 @@ sub string { my $params = $c->cobrand->disambiguate_location(); 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; -- cgit v1.2.3 From c88225882f16eef4a2f3002ea448c00fbbcf3713 Mon Sep 17 00:00:00 2001 From: Matthew Somerville Date: Fri, 13 Jul 2012 10:39:46 +0100 Subject: Remove any Northern Ireland specific code. --- perllib/FixMyStreet/Geocode.pm | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'perllib/FixMyStreet/Geocode.pm') diff --git a/perllib/FixMyStreet/Geocode.pm b/perllib/FixMyStreet/Geocode.pm index e5983810b..f2bc1ac95 100644 --- a/perllib/FixMyStreet/Geocode.pm +++ b/perllib/FixMyStreet/Geocode.pm @@ -17,9 +17,8 @@ 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); -- cgit v1.2.3 From f7e6c593e8c3807348529b6b984d944462270ee0 Mon Sep 17 00:00:00 2001 From: Struan Donald Date: Mon, 30 Jul 2012 16:59:08 +0100 Subject: add partial postcode for bromley high street lookup to help bing --- perllib/FixMyStreet/Geocode.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'perllib/FixMyStreet/Geocode.pm') diff --git a/perllib/FixMyStreet/Geocode.pm b/perllib/FixMyStreet/Geocode.pm index f2bc1ac95..f92e9cc9a 100644 --- a/perllib/FixMyStreet/Geocode.pm +++ b/perllib/FixMyStreet/Geocode.pm @@ -38,7 +38,7 @@ 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 access with and without a key -- cgit v1.2.3