aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Arter <davea@mysociety.org>2019-05-21 14:52:05 +0100
committerDave Arter <davea@mysociety.org>2019-06-04 14:54:52 +0100
commitd908149bd543563a80aca35eaed809d587a312f4 (patch)
tree2af62e20cb9908a5eab154adf6893f553c29b501
parenteb1404d8f0c9407eb0836b006ef461d9b0b2eca7 (diff)
[Hounslow] Use custom WMTS base map
-rw-r--r--perllib/FixMyStreet/Map/Hounslow.pm57
-rw-r--r--templates/web/hounslow/about/mapterms.html24
-rw-r--r--web/cobrands/hounslow/assets.js16
-rw-r--r--web/cobrands/hounslow/base.scss4
-rw-r--r--web/js/map-wmts-hounslow.js194
5 files changed, 285 insertions, 10 deletions
diff --git a/perllib/FixMyStreet/Map/Hounslow.pm b/perllib/FixMyStreet/Map/Hounslow.pm
index 231fc4258..ce0831196 100644
--- a/perllib/FixMyStreet/Map/Hounslow.pm
+++ b/perllib/FixMyStreet/Map/Hounslow.pm
@@ -1,17 +1,64 @@
# FixMyStreet:Map::Hounslow
-# More JavaScript, for street assets
+# Hounslow use their own tiles on their cobrand
package FixMyStreet::Map::Hounslow;
-use base 'FixMyStreet::Map::FMS';
+use base 'FixMyStreet::Map::UKCouncilWMTS';
use strict;
+sub default_zoom { 5; }
+
+sub urls { [ 'https://gis.ringway.co.uk/server/rest/services/Hosted/HounslowOSBasemap/MapServer/WMTS/tile' ] }
+
+sub layer_names { [ 'Hosted_HounslowOSBasemap' ] }
+
+sub scales {
+ my $self = shift;
+ my @scales = (
+ # The first 5 levels don't load and are really zoomed-out, so
+ # they're not included here.
+ # '600000',
+ # '500000',
+ # '400000',
+ # '300000',
+ # '200000',
+ '100000',
+ '75000',
+ '50000',
+ '25000',
+ '10000',
+ '8000',
+ '6000',
+ '4000',
+ '2000',
+ '1000',
+ '400',
+ );
+ return @scales;
+}
+
+sub zoom_parameters {
+ my $self = shift;
+ my $params = {
+ zoom_levels => scalar $self->scales,
+ default_zoom => $self->default_zoom,
+ min_zoom_level => 0,
+ id_offset => 5, # see note above about zoom layers we've skipped
+ };
+ return $params;
+}
+
+sub copyright {
+ return 'Contains Ordnance Survey data &copy; Crown copyright and database rights 2019 OS. Use of this data is subject to <a href="/about/mapterms">terms and conditions</a>.';
+}
+
+
sub map_javascript { [
- '/vendor/OpenLayers/OpenLayers.wfs.js',
+ '/vendor/OpenLayers/OpenLayers.wmts.js',
'/vendor/OpenLayers.Projection.OrdnanceSurvey.js',
'/js/map-OpenLayers.js',
- '/js/map-bing-ol.js',
- '/js/map-fms.js',
+ '/js/map-wmts-base.js',
+ '/js/map-wmts-hounslow.js',
'/cobrands/fixmystreet-uk-councils/roadworks.js',
'/cobrands/fixmystreet/assets.js',
'/cobrands/hounslow/js.js',
diff --git a/templates/web/hounslow/about/mapterms.html b/templates/web/hounslow/about/mapterms.html
new file mode 100644
index 000000000..04c0aeb09
--- /dev/null
+++ b/templates/web/hounslow/about/mapterms.html
@@ -0,0 +1,24 @@
+[% INCLUDE header.html
+ title = 'Map Terms and Conditions'
+%]
+
+<h1>Map Terms and Conditions</h1>
+
+<ul>
+ <li>
+ I. You are granted a non-exclusive, royalty free revocable licence
+ solely to view the licensed data for non-commercial purposes for the
+ period during which mySociety Ltd. makes it available;
+ </li>
+ <li>
+ II. You are not permitted to copy, sub-license, distribute, sell or
+ otherwise make available the Licensed Data to third parties in any form;
+ and
+ </li>
+ <li>
+ III. Third party rights to enforce the terms of this licence shall be
+ reserved to OS.
+ </li>
+</ul>
+[% INCLUDE footer.html %]
+
diff --git a/web/cobrands/hounslow/assets.js b/web/cobrands/hounslow/assets.js
index 4029ac7cd..e6d3383ff 100644
--- a/web/cobrands/hounslow/assets.js
+++ b/web/cobrands/hounslow/assets.js
@@ -11,20 +11,23 @@ var defaults = {
SERVICE: "WFS",
VERSION: "1.1.0",
REQUEST: "GetFeature",
- SRSNAME: "urn:ogc:def:crs:EPSG::3857"
+ SRSNAME: "urn:ogc:def:crs:EPSG::27700"
}
},
format_class: OpenLayers.Format.GML.v3.MultiCurveFix,
asset_type: 'spot',
- max_resolution: 2.388657133579254,
- min_resolution: 0.5971642833948135,
+ max_resolution: {
+ 'hounslow': 0.5291677250021167,
+ 'fixmystreet': 1.194328566789627
+ },
+ min_resolution: 0.00001,
asset_id_field: 'CentralAssetId',
attributes: {
central_asset_id: 'CentralAssetId',
asset_details: 'FeatureId'
},
geometryName: 'msGeometry',
- srsName: "EPSG:3857",
+ srsName: "EPSG:27700",
strategy_class: OpenLayers.Strategy.FixMyStreet,
body: "Hounslow Borough Council"
};
@@ -216,7 +219,10 @@ fixmystreet.assets.add($.extend(true, {}, defaults, {
TYPENAME: "streets"
}
},
- max_resolution: 4.777314267158508,
+ max_resolution: {
+ 'hounslow': 6.614596562526458,
+ 'fixmystreet': 4.777314267158508
+ },
always_visible: true,
non_interactive: true,
usrn: {
diff --git a/web/cobrands/hounslow/base.scss b/web/cobrands/hounslow/base.scss
index e0ba3953c..b49f7b97d 100644
--- a/web/cobrands/hounslow/base.scss
+++ b/web/cobrands/hounslow/base.scss
@@ -15,6 +15,10 @@
color: $white;
}
+#map_box #map {
+ background-color: white;
+}
+
.btn-primary,
.green-btn,
.btn--primary {
diff --git a/web/js/map-wmts-hounslow.js b/web/js/map-wmts-hounslow.js
new file mode 100644
index 000000000..ea414a3d8
--- /dev/null
+++ b/web/js/map-wmts-hounslow.js
@@ -0,0 +1,194 @@
+/*
+ * Maps for FMS using Hounslow Highways' WMTS tile server
+ */
+
+fixmystreet.maps.layer_bounds = new OpenLayers.Bounds(
+ 500968.38879189314,
+ 164348.14012837573,
+ 528802.2803971764,
+ 185779.43299096148);
+
+fixmystreet.maps.matrix_ids = [
+ // The first 5 levels don't load and are really zoomed-out, so
+ // they're not included here.
+ // {
+ // "identifier": 0,
+ // "scaleDenominator": 566965.4196450538,
+ // "supportedCRS": "urn:ogc:def:crs:EPSG:27700",
+ // "tileWidth": 256,
+ // "tileHeight": 256,
+ // "matrixWidth": 142,
+ // "matrixHeight": 106,
+ // },
+ // {
+ // "identifier": 1,
+ // "scaleDenominator": 472471.18303754483,
+ // "supportedCRS": "urn:ogc:def:crs:EPSG:27700",
+ // "tileWidth": 256,
+ // "tileHeight": 256,
+ // "matrixWidth": 170,
+ // "matrixHeight": 128,
+ // },
+ // {
+ // "identifier": 2,
+ // "scaleDenominator": 377976.9464300358,
+ // "supportedCRS": "urn:ogc:def:crs:EPSG:27700",
+ // "tileWidth": 256,
+ // "tileHeight": 256,
+ // "matrixWidth": 213,
+ // "matrixHeight": 159,
+ // },
+ // {
+ // "identifier": 3,
+ // "scaleDenominator": 283482.7098225269,
+ // "supportedCRS": "urn:ogc:def:crs:EPSG:27700",
+ // "tileWidth": 256,
+ // "tileHeight": 256,
+ // "matrixWidth": 283,
+ // "matrixHeight": 212,
+ // },
+ // {
+ // "identifier": 4,
+ // "scaleDenominator": 188988.4732150179,
+ // "supportedCRS": "urn:ogc:def:crs:EPSG:27700",
+ // "tileWidth": 256,
+ // "tileHeight": 256,
+ // "matrixWidth": 425,
+ // "matrixHeight": 318,
+ // },
+ {
+ "identifier": 5,
+ "scaleDenominator": 94494.23660750895,
+ "supportedCRS": "urn:ogc:def:crs:EPSG:27700",
+ "tileWidth": 256,
+ "tileHeight": 256,
+ "matrixWidth": 849,
+ "matrixHeight": 636,
+ },
+ {
+ "identifier": 6,
+ "scaleDenominator": 70870.67745563173,
+ "supportedCRS": "urn:ogc:def:crs:EPSG:27700",
+ "tileWidth": 256,
+ "tileHeight": 256,
+ "matrixWidth": 1132,
+ "matrixHeight": 848,
+ },
+ {
+ "identifier": 7,
+ "scaleDenominator": 47247.118303754476,
+ "supportedCRS": "urn:ogc:def:crs:EPSG:27700",
+ "tileWidth": 256,
+ "tileHeight": 256,
+ "matrixWidth": 1698,
+ "matrixHeight": 1272,
+ },
+ {
+ "identifier": 8,
+ "scaleDenominator": 23623.559151877238,
+ "supportedCRS": "urn:ogc:def:crs:EPSG:27700",
+ "tileWidth": 256,
+ "tileHeight": 256,
+ "matrixWidth": 3396,
+ "matrixHeight": 2543,
+ },
+ {
+ "identifier": 9,
+ "scaleDenominator": 9449.423660750896,
+ "supportedCRS": "urn:ogc:def:crs:EPSG:27700",
+ "tileWidth": 256,
+ "tileHeight": 256,
+ "matrixWidth": 8488,
+ "matrixHeight": 6358,
+ },
+ {
+ "identifier": 10,
+ "scaleDenominator": 7559.538928600717,
+ "supportedCRS": "urn:ogc:def:crs:EPSG:27700",
+ "tileWidth": 256,
+ "tileHeight": 256,
+ "matrixWidth": 10610,
+ "matrixHeight": 7947,
+ },
+ {
+ "identifier": 11,
+ "scaleDenominator": 5669.654196450538,
+ "supportedCRS": "urn:ogc:def:crs:EPSG:27700",
+ "tileWidth": 256,
+ "tileHeight": 256,
+ "matrixWidth": 14147,
+ "matrixHeight": 10596,
+ },
+ {
+ "identifier": 12,
+ "scaleDenominator": 3779.7694643003583,
+ "supportedCRS": "urn:ogc:def:crs:EPSG:27700",
+ "tileWidth": 256,
+ "tileHeight": 256,
+ "matrixWidth": 21220,
+ "matrixHeight": 15893,
+ },
+ {
+ "identifier": 13,
+ "scaleDenominator": 1889.8847321501792,
+ "supportedCRS": "urn:ogc:def:crs:EPSG:27700",
+ "tileWidth": 256,
+ "tileHeight": 256,
+ "matrixWidth": 42440,
+ "matrixHeight": 31786,
+ },
+ {
+ "identifier": 14,
+ "scaleDenominator": 944.9423660750896,
+ "supportedCRS": "urn:ogc:def:crs:EPSG:27700",
+ "tileWidth": 256,
+ "tileHeight": 256,
+ "matrixWidth": 84880,
+ "matrixHeight": 63571,
+ },
+ {
+ "identifier": 15,
+ "scaleDenominator": 377.9769464300358,
+ "supportedCRS": "urn:ogc:def:crs:EPSG:27700",
+ "tileWidth": 256,
+ "tileHeight": 256,
+ "matrixWidth": 212200,
+ "matrixHeight": 158927,
+ }
+];
+
+/*
+ * maps.config() is called on dom ready in map-OpenLayers.js
+ * to setup the way the map should operate.
+ */
+fixmystreet.maps.config = function() {
+ var permalink_id;
+ if ($('#map_permalink').length) {
+ permalink_id = 'map_permalink';
+ }
+
+ fixmystreet.controls = [
+ new OpenLayers.Control.ArgParserFMS(),
+ new OpenLayers.Control.Navigation(),
+ new OpenLayers.Control.PermalinkFMS(permalink_id),
+ new OpenLayers.Control.PanZoomFMS({id: 'fms_pan_zoom' })
+ ];
+
+ /* Linking back to around from report page, keeping track of map moves */
+ if ( fixmystreet.page == 'report' ) {
+ fixmystreet.controls.push( new OpenLayers.Control.PermalinkFMS('key-tool-problems-nearby', '/around') );
+ }
+
+ this.setup_wmts_base_map();
+};
+
+fixmystreet.maps.marker_size = function() {
+ var zoom = fixmystreet.map.getZoom() + fixmystreet.zoomOffset;
+ if (zoom >= 8) {
+ return 'normal';
+ } else if (zoom >= 4) {
+ return 'small';
+ } else {
+ return 'mini';
+ }
+};