aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/Geocode.pm
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@fury.ukcod.org.uk>2011-02-14 10:58:39 +0000
committerMatthew Somerville <matthew@fury.ukcod.org.uk>2011-02-14 10:58:39 +0000
commit1421ac837449d153fbd517caa550d26052156a21 (patch)
treead56974a940adc6a0c80c44c00a4394411def101 /perllib/FixMyStreet/Geocode.pm
parent6d3116177aacc8d193c9c5ec126e3dbe9b83f79a (diff)
Only do lat/lon->E/N check if country is GB.
Diffstat (limited to 'perllib/FixMyStreet/Geocode.pm')
-rw-r--r--perllib/FixMyStreet/Geocode.pm16
1 files changed, 9 insertions, 7 deletions
diff --git a/perllib/FixMyStreet/Geocode.pm b/perllib/FixMyStreet/Geocode.pm
index ae85aba15..892077d6e 100644
--- a/perllib/FixMyStreet/Geocode.pm
+++ b/perllib/FixMyStreet/Geocode.pm
@@ -65,13 +65,15 @@ sub geocoded_string_coordinates {
} elsif ( $js =~ /"coordinates" *: *\[ *(.*?), *(.*?),/ ) {
$longitude = $1;
$latitude = $2;
- try {
- my ($easting, $northing) = Utils::convert_latlon_to_en( $latitude, $longitude );
- } catch Error::Simple with {
- mySociety::Locale::pop(); # We threw exception, so it won't have happened.
- $error = shift;
- $error = _('That location does not appear to be in Britain; please try again.')
- if $error =~ /out of the area covered/;
+ if (mySociety::Config::get('COUNTRY') eq 'GB') {
+ try {
+ my ($easting, $northing) = Utils::convert_latlon_to_en( $latitude, $longitude );
+ } catch Error::Simple with {
+ mySociety::Locale::pop(); # We threw exception, so it won't have happened.
+ $error = shift;
+ $error = _('That location does not appear to be in Britain; please try again.')
+ if $error =~ /out of the area covered/;
+ }
}
}
return ($latitude, $longitude, $error);