diff options
author | Matthew Somerville <matthew@mysociety.org> | 2019-09-19 20:27:46 +0100 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2019-09-19 20:27:46 +0100 |
commit | 9d12ecc52d5a3413b12d3781349e228026e79f5e (patch) | |
tree | b3fdabfa42cf0c7264f5ecb29ccb6a8637fb0107 /perllib/FixMyStreet/Geocode/OSM.pm | |
parent | 645c0663c4c7ce2d2d240858ed06446efe8ad328 (diff) | |
parent | fa879675558632ae54b32a10707397a01edc362d (diff) |
Merge branch 'bexley-map-tiles'
Diffstat (limited to 'perllib/FixMyStreet/Geocode/OSM.pm')
-rw-r--r-- | perllib/FixMyStreet/Geocode/OSM.pm | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/perllib/FixMyStreet/Geocode/OSM.pm b/perllib/FixMyStreet/Geocode/OSM.pm index 0d296f299..a36ae3192 100644 --- a/perllib/FixMyStreet/Geocode/OSM.pm +++ b/perllib/FixMyStreet/Geocode/OSM.pm @@ -23,7 +23,7 @@ my $nominatimbase = "http://nominatim.openstreetmap.org/"; # an array of matches if there are more than one. The information in the query # may be used to disambiguate the location in cobranded versions of the site. sub string { - my ( $s, $c ) = @_; + my ( $cls, $s, $c ) = @_; my $params = $c->cobrand->disambiguate_location($s); # Allow cobrand to fixup the user input @@ -52,14 +52,15 @@ sub string { return { error => _('Sorry, we could not find that location.') }; } - my ( $error, @valid_locations, $latitude, $longitude ); + my ( $error, @valid_locations, $latitude, $longitude, $address ); foreach (@$js) { $c->cobrand->call_hook(geocoder_munge_results => $_); ( $latitude, $longitude ) = map { Utils::truncate_coordinate($_) } ( $_->{lat}, $_->{lon} ); + $address = $_->{display_name}; push (@$error, { - address => $_->{display_name}, + address => $address, icon => $_->{icon}, latitude => $latitude, longitude => $longitude @@ -67,7 +68,7 @@ sub string { push (@valid_locations, $_); } - return { latitude => $latitude, longitude => $longitude } if scalar @valid_locations == 1; + return { latitude => $latitude, longitude => $longitude, address => $address } if scalar @valid_locations == 1; return { error => $error }; } |