diff options
author | Matthew Somerville <matthew@fury.ukcod.org.uk> | 2011-03-05 19:57:53 +0000 |
---|---|---|
committer | Matthew Somerville <matthew@fury.ukcod.org.uk> | 2011-03-05 19:57:53 +0000 |
commit | b5e5e382bd8b43693dbe01b5f5157b61f527641b (patch) | |
tree | 64df75159be8427f2d94af70c0d519da82386381 /perllib/FixMyStreet/Geocode.pm | |
parent | 71a81d5c371f737b75ab087d618b75b3986a57d5 (diff) |
Handle NO postcodes via mapit.
Diffstat (limited to 'perllib/FixMyStreet/Geocode.pm')
-rw-r--r-- | perllib/FixMyStreet/Geocode.pm | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/Geocode.pm b/perllib/FixMyStreet/Geocode.pm index 02cdf214c..c06c3bb55 100644 --- a/perllib/FixMyStreet/Geocode.pm +++ b/perllib/FixMyStreet/Geocode.pm @@ -50,6 +50,14 @@ sub lookup { $longitude = $location->{wgs84_lon}; } } + } elsif (mySociety::Config::get('COUNTRY') eq 'NO') { + if ($s =~ /^\d{4}$/) { + my $location = mySociety::MaPit::call('postcode', $s); + unless ($error = Page::mapit_check_error($location)) { + $latitude = $location->{wgs84_lat}; + $longitude = $location->{wgs84_lon}; + } + } } unless ($error || defined $latitude) { ($latitude, $longitude, $error) = FixMyStreet::Geocode::string($s, $q); |