aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStruan Donald <struan@exo.org.uk>2019-08-30 15:24:33 +0100
committerMatthew Somerville <matthew@mysociety.org>2019-09-13 09:51:21 +0100
commit1331d390ffbd28ec1bf5cbacc408eddef52cddb6 (patch)
tree6445570a9c0ca6fa51d79b5f3dea9e73536c4f63
parent9449e4c6628666a32dce4061b8b43141b93616d5 (diff)
do not reproject uk wmts map if no coordinates
If the coordinates are (0,0) then return that straight back as trying to reproject causes Geography::NationalGrid::GB to fall over as 0 lat is outside UK Fixes #2617
-rw-r--r--perllib/FixMyStreet/Map/UKCouncilWMTS.pm2
-rw-r--r--t/cobrand/bristol.t10
2 files changed, 12 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/Map/UKCouncilWMTS.pm b/perllib/FixMyStreet/Map/UKCouncilWMTS.pm
index da0720f06..aba6d3840 100644
--- a/perllib/FixMyStreet/Map/UKCouncilWMTS.pm
+++ b/perllib/FixMyStreet/Map/UKCouncilWMTS.pm
@@ -36,6 +36,8 @@ sub tile_parameters {
# Reproject a WGS84 lat/lon into BNG easting/northing
sub reproject_from_latlon($$$) {
my ($self, $lat, $lon) = @_;
+ # do not try to reproject if we have no co-ordindates as convert breaks
+ return (0.0, 0.0) if $lat == 0 && $lon == 0;
my ($x, $y) = Utils::convert_latlon_to_en($lat, $lon);
return ($x, $y);
}
diff --git a/t/cobrand/bristol.t b/t/cobrand/bristol.t
index b2b8cff13..d4770b6ee 100644
--- a/t/cobrand/bristol.t
+++ b/t/cobrand/bristol.t
@@ -21,6 +21,16 @@ my $email_contact = $mech->create_contact_ok(
send_method => 'Email'
);
+subtest 'Reports page works with no reports', sub {
+ FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ 'bristol' ],
+ MAPIT_URL => 'http://mapit.uk/',
+ MAP_TYPE => 'Bristol',
+ }, sub {
+ $mech->get_ok("/reports");
+ };
+};
+
subtest 'Only Open311 categories are shown on Bristol cobrand', sub {
FixMyStreet::override_config {
ALLOWED_COBRANDS => [ 'bristol' ],