aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet
diff options
context:
space:
mode:
Diffstat (limited to 'perllib/FixMyStreet')
-rw-r--r--perllib/FixMyStreet/Cobrand/Peterborough.pm32
-rw-r--r--perllib/FixMyStreet/Geocode/OSM.pm1
2 files changed, 33 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/Cobrand/Peterborough.pm b/perllib/FixMyStreet/Cobrand/Peterborough.pm
new file mode 100644
index 000000000..4e5b75751
--- /dev/null
+++ b/perllib/FixMyStreet/Cobrand/Peterborough.pm
@@ -0,0 +1,32 @@
+package FixMyStreet::Cobrand::Peterborough;
+use parent 'FixMyStreet::Cobrand::Whitelabel';
+
+use strict;
+use warnings;
+
+sub council_area_id { 2566 }
+sub council_area { 'Peterborough' }
+sub council_name { 'Peterborough City Council' }
+sub council_url { 'peterborough' }
+
+sub disambiguate_location {
+ my $self = shift;
+ my $string = shift;
+
+ return {
+ %{ $self->SUPER::disambiguate_location() },
+ centre => '52.6085234396978,-0.253091266573947',
+ bounds => [ 52.5060949603654, -0.497663559599628, 52.6752139533306, -0.0127696975457487 ],
+ };
+}
+
+sub get_geocoder { 'OSM' }
+
+sub geocoder_munge_results {
+ my ($self, $result) = @_;
+ $result->{display_name} = '' unless $result->{display_name} =~ /City of Peterborough/;
+ $result->{display_name} =~ s/, UK$//;
+ $result->{display_name} =~ s/, City of Peterborough, East of England, England//;
+}
+
+1;
diff --git a/perllib/FixMyStreet/Geocode/OSM.pm b/perllib/FixMyStreet/Geocode/OSM.pm
index a36ae3192..6e6dbfbb1 100644
--- a/perllib/FixMyStreet/Geocode/OSM.pm
+++ b/perllib/FixMyStreet/Geocode/OSM.pm
@@ -55,6 +55,7 @@ sub string {
my ( $error, @valid_locations, $latitude, $longitude, $address );
foreach (@$js) {
$c->cobrand->call_hook(geocoder_munge_results => $_);
+ next unless $_->{display_name};
( $latitude, $longitude ) =
map { Utils::truncate_coordinate($_) }
( $_->{lat}, $_->{lon} );