aboutsummaryrefslogtreecommitdiffstats
path: root/perllib
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2018-06-20 08:04:28 +0100
committerMatthew Somerville <matthew-github@dracos.co.uk>2018-06-20 08:04:28 +0100
commit873ea570cc429b378eb33c8de90570a10414264c (patch)
tree094b86743e3e0267ec04fb36cb3f2245d402f163 /perllib
parent85ae59fdd1d8690efc569a193853072eb2519c89 (diff)
parente133cdcfda4b25e3fd04db6febf663009add05bc (diff)
Merge branch 'issues/commercial/1064-main-road-br5'
Diffstat (limited to 'perllib')
-rw-r--r--perllib/FixMyStreet/Cobrand/Bromley.pm12
-rw-r--r--perllib/FixMyStreet/Geocode.pm2
-rw-r--r--perllib/FixMyStreet/Geocode/OSM.pm2
3 files changed, 11 insertions, 5 deletions
diff --git a/perllib/FixMyStreet/Cobrand/Bromley.pm b/perllib/FixMyStreet/Cobrand/Bromley.pm
index 36a3e3d5f..0f2f37654 100644
--- a/perllib/FixMyStreet/Cobrand/Bromley.pm
+++ b/perllib/FixMyStreet/Cobrand/Bromley.pm
@@ -37,18 +37,24 @@ sub disambiguate_location {
# a different Priory Avenue in Petts Wood
# From Google maps search, "BR6 0PL" is a valid postcode for Old Priory Avenue
if ($string =~/^old\s+priory\s+av\w*$/i) {
- $string = 'Ramsden Road';
- $town = ', BR6 0PL';
+ $town = 'BR6 0PL';
}
# White Horse Hill is on boundary with Greenwich, so need a
# specific postcode
- $string = 'BR7 6DH' if $string =~ /^white\s+horse/i;
+ $town = 'BR7 6DH' if $string =~ /^white\s+horse/i;
$town = '' if $string =~ /orpington/i;
+ $string =~ s/(, *)?br[12]$//i;
+ $town = 'Beckenham' if $string =~ s/(, *)?br3$//i;
+ $town = 'West Wickham' if $string =~ s/(, *)?br4$//i;
+ $town = 'Orpington' if $string =~ s/(, *)?br[56]$//i;
+ $town = 'Chislehurst' if $string =~ s/(, *)?br7$//i;
+ $town = 'Swanley' if $string =~ s/(, *)?br8$//i;
return {
%{ $self->SUPER::disambiguate_location() },
+ string => $string,
town => $town,
centre => '51.366836,0.040623',
span => '0.154963,0.24347',
diff --git a/perllib/FixMyStreet/Geocode.pm b/perllib/FixMyStreet/Geocode.pm
index aeac0ab6d..d552afaa5 100644
--- a/perllib/FixMyStreet/Geocode.pm
+++ b/perllib/FixMyStreet/Geocode.pm
@@ -59,7 +59,7 @@ sub string {
sub escape {
my ($s, $c) = @_;
$s = lc($s);
- $s =~ s/[^-&\w ']/ /g;
+ $s =~ s/[^-&\w ',]/ /g;
$s =~ s/\s+/ /g;
$s = URI::Escape::uri_escape_utf8($s);
$s =~ s/%20/+/g;
diff --git a/perllib/FixMyStreet/Geocode/OSM.pm b/perllib/FixMyStreet/Geocode/OSM.pm
index 4d57007c5..0d296f299 100644
--- a/perllib/FixMyStreet/Geocode/OSM.pm
+++ b/perllib/FixMyStreet/Geocode/OSM.pm
@@ -30,7 +30,7 @@ sub string {
$s = $params->{string} if $params->{string};
$s = FixMyStreet::Geocode::escape($s);
- $s .= '+' . $params->{town} if $params->{town} and $s !~ /$params->{town}/i;
+ $s .= '%2C+' . $params->{town} if $params->{town} and $s !~ /$params->{town}/i;
my $url = "${nominatimbase}search?";
my %query_params = (