aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/DB/Result/Problem.pm
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2016-06-22 18:18:38 +0100
committerMatthew Somerville <matthew-github@dracos.co.uk>2016-06-22 18:20:35 +0100
commit19241c52172aec0c797a00b35a090e28f7858e1d (patch)
tree21a81d44f5c10ce8ffbbc862b113280ccaef3a5b /perllib/FixMyStreet/DB/Result/Problem.pm
parent368d980d25c00248f46b7e8ca8fec287e5dff58d (diff)
Tidy up some UK specific easting/northing handling
Diffstat (limited to 'perllib/FixMyStreet/DB/Result/Problem.pm')
-rw-r--r--perllib/FixMyStreet/DB/Result/Problem.pm13
1 files changed, 8 insertions, 5 deletions
diff --git a/perllib/FixMyStreet/DB/Result/Problem.pm b/perllib/FixMyStreet/DB/Result/Problem.pm
index 5b853134e..628497233 100644
--- a/perllib/FixMyStreet/DB/Result/Problem.pm
+++ b/perllib/FixMyStreet/DB/Result/Problem.pm
@@ -160,6 +160,7 @@ __PACKAGE__->rabx_column('geocode');
use Moo;
use namespace::clean -except => [ 'meta' ];
use Utils;
+use FixMyStreet::Map::FMS;
with 'FixMyStreet::Roles::Abuser',
'FixMyStreet::Roles::Extra';
@@ -672,13 +673,15 @@ sub duration_string {
sub local_coords {
my $self = shift;
- if ($self->cobrand eq 'zurich') {
+ my $cobrand = FixMyStreet::Cobrand->get_class_for_moniker($self->cobrand)->new;
+ if ($cobrand->moniker eq 'zurich') {
my ($x, $y) = Geo::Coordinates::CH1903::from_latlon($self->latitude, $self->longitude);
return ( int($x+0.5), int($y+0.5) );
- }
- else {
- # return a dummy value until this function is implemented. useful for testing.
- return (0, 0);
+ } elsif ($cobrand->country eq 'GB') {
+ my $coordsyst = 'G';
+ $coordsyst = 'I' if FixMyStreet::Map::FMS::in_northern_ireland_box($self->latitude, $self->longitude);
+ my ($x, $y) = Utils::convert_latlon_to_en( $self->latitude, $self->longitude, $coordsyst );
+ return ($x, $y, $coordsyst);
}
}