aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet
diff options
context:
space:
mode:
Diffstat (limited to 'perllib/FixMyStreet')
-rw-r--r--perllib/FixMyStreet/Cobrand/Hounslow.pm23
-rw-r--r--perllib/FixMyStreet/Cobrand/UKCouncils.pm2
-rw-r--r--perllib/FixMyStreet/Map/Hounslow.pm21
3 files changed, 46 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/Cobrand/Hounslow.pm b/perllib/FixMyStreet/Cobrand/Hounslow.pm
index 04533ce80..ac8d904ee 100644
--- a/perllib/FixMyStreet/Cobrand/Hounslow.pm
+++ b/perllib/FixMyStreet/Cobrand/Hounslow.pm
@@ -10,6 +10,8 @@ sub council_name { 'Hounslow Borough Council' }
sub council_url { 'hounslow' }
sub example_places { ( 'TW3 1SN', "Depot Road" ) }
+sub map_type { 'Hounslow' }
+
sub base_url {
my $self = shift;
return $self->next::method() if FixMyStreet->config('STAGING_SITE');
@@ -68,6 +70,18 @@ sub open311_config {
{ name => 'description',
value => $row->detail };
+ # Reports made via FMS.com or the app probably won't have a site code
+ # value because we don't display the adopted highways layer on those
+ # frontends. Instead we'll look up the closest asset from the WFS
+ # service at the point we're sending the report over Open311.
+ if (!$row->get_extra_field_value('site_code')) {
+ if (my $site_code = $self->lookup_site_code($row)) {
+ push @$extra,
+ { name => 'site_code',
+ value => $site_code };
+ }
+ }
+
$row->set_extra_fields(@$extra);
}
@@ -80,4 +94,13 @@ sub should_skip_sending_update {
}
+sub lookup_site_code_config { {
+ buffer => 50, # metres
+ url => "https://tilma.mysociety.org/mapserver/hounslow",
+ srsname => "urn:ogc:def:crs:EPSG::27700",
+ typename => "streets",
+ property => "SITE_CODE",
+ accept_feature => sub { 1 }
+} }
+
1;
diff --git a/perllib/FixMyStreet/Cobrand/UKCouncils.pm b/perllib/FixMyStreet/Cobrand/UKCouncils.pm
index 09ca6c535..c21ed6401 100644
--- a/perllib/FixMyStreet/Cobrand/UKCouncils.pm
+++ b/perllib/FixMyStreet/Cobrand/UKCouncils.pm
@@ -282,6 +282,8 @@ sub lookup_site_code {
my $response = get($uri);
+ return '' unless $response;
+
my $j = JSON->new->utf8->allow_nonref;
try {
$j = $j->decode($response);
diff --git a/perllib/FixMyStreet/Map/Hounslow.pm b/perllib/FixMyStreet/Map/Hounslow.pm
new file mode 100644
index 000000000..231fc4258
--- /dev/null
+++ b/perllib/FixMyStreet/Map/Hounslow.pm
@@ -0,0 +1,21 @@
+# FixMyStreet:Map::Hounslow
+# More JavaScript, for street assets
+
+package FixMyStreet::Map::Hounslow;
+use base 'FixMyStreet::Map::FMS';
+
+use strict;
+
+sub map_javascript { [
+ '/vendor/OpenLayers/OpenLayers.wfs.js',
+ '/vendor/OpenLayers.Projection.OrdnanceSurvey.js',
+ '/js/map-OpenLayers.js',
+ '/js/map-bing-ol.js',
+ '/js/map-fms.js',
+ '/cobrands/fixmystreet-uk-councils/roadworks.js',
+ '/cobrands/fixmystreet/assets.js',
+ '/cobrands/hounslow/js.js',
+ '/cobrands/hounslow/assets.js',
+] }
+
+1;