Author: kake Date: 2012-07-04 11:01:45 +0100 (Wed, 04 Jul 2012) New Revision: 1420
Modified: trunk/lib/OpenGuides/Utils.pm Log: Added missing bit that should have gone in commit [1419].
Modified: trunk/lib/OpenGuides/Utils.pm =================================================================== --- trunk/lib/OpenGuides/Utils.pm 2012-07-04 09:58:34 UTC (rev 1419) +++ trunk/lib/OpenGuides/Utils.pm 2012-07-04 10:01:45 UTC (rev 1420) @@ -358,6 +358,8 @@ The hashes in the C<nodes> argument can include other key/value pairs; these will just be ignored.
+Returns false if it can't find any valid geodata in the nodes. + =cut
sub get_wgs84_min_max { @@ -372,6 +374,11 @@ grep { defined $_ && /^[-.\d]+$/ } map { $_->{wgs84_long} } @nodes; + + if ( !scalar @lats || !scalar @longs ) { + return; + } + my %data = ( min_lat => $lats[0], max_lat => $lats[$#lats], min_long => $longs[0], max_long => $longs[$#longs] ); $data{centre_lat} = ( $data{min_lat} + $data{max_lat} ) / 2;
openguides-commits@lists.openguides.org