aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/Geocode.pm
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@fury.ukcod.org.uk>2011-03-05 19:57:53 +0000
committerMatthew Somerville <matthew@fury.ukcod.org.uk>2011-03-05 19:57:53 +0000
commitb5e5e382bd8b43693dbe01b5f5157b61f527641b (patch)
tree64df75159be8427f2d94af70c0d519da82386381 /perllib/FixMyStreet/Geocode.pm
parent71a81d5c371f737b75ab087d618b75b3986a57d5 (diff)
Handle NO postcodes via mapit.
Diffstat (limited to 'perllib/FixMyStreet/Geocode.pm')
-rw-r--r--perllib/FixMyStreet/Geocode.pm8
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);