aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--perllib/FixMyStreet/Cobrand/Peterborough.pm22
-rw-r--r--templates/web/fixmystreet.com/footer_extra_js.html1
-rw-r--r--templates/web/peterborough/footer_extra_js.html1
-rw-r--r--web/cobrands/peterborough/js.js41
4 files changed, 65 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/Cobrand/Peterborough.pm b/perllib/FixMyStreet/Cobrand/Peterborough.pm
index 5ea847c89..46242fcf3 100644
--- a/perllib/FixMyStreet/Cobrand/Peterborough.pm
+++ b/perllib/FixMyStreet/Cobrand/Peterborough.pm
@@ -49,9 +49,31 @@ sub open311_config {
# remove the emergency category which is informational only
@$extra = grep { $_->{name} ne 'emergency' } @$extra;
+ # 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);
}
+sub lookup_site_code_config { {
+ buffer => 50, # metres
+ url => "https://tilma.mysociety.org/mapserver/peterborough",
+ srsname => "urn:ogc:def:crs:EPSG::27700",
+ typename => "highways",
+ property => "Usrn",
+ accept_feature => sub { 1 },
+ accept_types => { Polygon => 1 },
+} }
+
sub open311_munge_update_params {
my ($self, $params, $comment, $body) = @_;
diff --git a/templates/web/fixmystreet.com/footer_extra_js.html b/templates/web/fixmystreet.com/footer_extra_js.html
index 6fcb5d59c..c8ad921f6 100644
--- a/templates/web/fixmystreet.com/footer_extra_js.html
+++ b/templates/web/fixmystreet.com/footer_extra_js.html
@@ -15,6 +15,7 @@ IF bodyclass.match('mappage');
scripts.push( version('/cobrands/northamptonshire/assets.js') );
scripts.push( version('/cobrands/hounslow/assets.js') );
scripts.push( version('/cobrands/westminster/assets.js') );
+ scripts.push( version('/cobrands/peterborough/js.js') );
scripts.push( version('/cobrands/highways/assets.js') );
scripts.push( version('/cobrands/fixmystreet-uk-councils/council_validation_rules.js') );
scripts.push(
diff --git a/templates/web/peterborough/footer_extra_js.html b/templates/web/peterborough/footer_extra_js.html
index 756ef495a..afed8d350 100644
--- a/templates/web/peterborough/footer_extra_js.html
+++ b/templates/web/peterborough/footer_extra_js.html
@@ -7,6 +7,7 @@ IF bodyclass.match('mappage');
scripts.push(
version('/vendor/OpenLayers.Projection.OrdnanceSurvey.js'),
version('/cobrands/fixmystreet/assets.js'),
+ version('/cobrands/peterborough/js.js'),
version('/cobrands/highways/assets.js'),
);
END
diff --git a/web/cobrands/peterborough/js.js b/web/cobrands/peterborough/js.js
new file mode 100644
index 000000000..47172712d
--- /dev/null
+++ b/web/cobrands/peterborough/js.js
@@ -0,0 +1,41 @@
+(function(){
+
+if (!fixmystreet.maps) {
+ return;
+}
+
+var defaults = {
+ http_options: {
+ url: "https://tilma.mysociety.org/mapserver/peterborough",
+ params: {
+ SERVICE: "WFS",
+ VERSION: "1.1.0",
+ REQUEST: "GetFeature",
+ SRSNAME: "urn:ogc:def:crs:EPSG::3857"
+ }
+ },
+ max_resolution: 4.777314267158508,
+ min_resolution: 0.5971642833948135,
+ geometryName: 'msGeometry',
+ srsName: "EPSG:3857",
+ body: "Peterborough City Council",
+ strategy_class: OpenLayers.Strategy.FixMyStreet
+};
+
+fixmystreet.assets.add(defaults, {
+ http_options: {
+ params: {
+ TYPENAME: "highways"
+ }
+ },
+ stylemap: fixmystreet.assets.stylemap_invisible,
+ non_interactive: true,
+ always_visible: true,
+ usrn: {
+ attribute: 'Usrn',
+ field: 'site_code'
+ },
+ name: "Adopted Highways"
+});
+
+})();