diff options
author | Struan Donald <struan@exo.org.uk> | 2019-07-10 17:13:25 +0100 |
---|---|---|
committer | Struan Donald <struan@exo.org.uk> | 2019-09-27 17:35:15 +0100 |
commit | 55db0bf4ddfb009ee5a310d1684158c90237c12c (patch) | |
tree | a720537f5d32cb215ed0ba2b30969f3a70e0627b | |
parent | 433474638e33c1320efd0b4826b5d4bbb655d69c (diff) |
[IsleOfWight] switch to IoW map tiles
-rw-r--r-- | perllib/FixMyStreet/Cobrand/IsleOfWight.pm | 2 | ||||
-rw-r--r-- | perllib/FixMyStreet/Map/IsleOfWight.pm | 63 | ||||
-rw-r--r-- | t/map/tests.t | 1 | ||||
-rw-r--r-- | templates/web/isleofwight/about/mapterms.html | 24 | ||||
-rw-r--r-- | templates/web/isleofwight/footer_extra_js.html | 3 | ||||
-rw-r--r-- | web/cobrands/isleofwight/base.scss | 4 | ||||
-rw-r--r-- | web/js/map-wmts-isleofwight.js | 206 |
7 files changed, 300 insertions, 3 deletions
diff --git a/perllib/FixMyStreet/Cobrand/IsleOfWight.pm b/perllib/FixMyStreet/Cobrand/IsleOfWight.pm index 864e53f36..9e48b4d77 100644 --- a/perllib/FixMyStreet/Cobrand/IsleOfWight.pm +++ b/perllib/FixMyStreet/Cobrand/IsleOfWight.pm @@ -24,7 +24,7 @@ sub send_questionnaires { 0 } sub report_sent_confirmation_email { 'external_id' } -sub map_type { 'OSM' } +sub map_type { 'IsleOfWight' } sub disambiguate_location { my $self = shift; diff --git a/perllib/FixMyStreet/Map/IsleOfWight.pm b/perllib/FixMyStreet/Map/IsleOfWight.pm new file mode 100644 index 000000000..2316e2939 --- /dev/null +++ b/perllib/FixMyStreet/Map/IsleOfWight.pm @@ -0,0 +1,63 @@ +# FixMyStreet:Map::IsleOfWight +# IsleOfWight use their own tiles on their cobrand + +package FixMyStreet::Map::IsleOfWight; +use base 'FixMyStreet::Map::UKCouncilWMTS'; + +use strict; + +sub default_zoom { 7; } + +sub urls { [ 'https://gis.ringway.co.uk/server/rest/services/Hosted/IOW_OS/MapServer/WMTS/tile' ] } + +sub layer_names { [ 'Hosted_IOW_OS' ] } + +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 © Crown copyright and database rights 2019 OS 100019229. Use of this data is subject to <a href="/about/mapterms">terms and conditions</a>.'; +} + + +sub map_javascript { [ + '/vendor/OpenLayers/OpenLayers.wmts.js', + '/js/map-OpenLayers.js', + '/js/map-wmts-base.js', + '/js/map-wmts-isleofwight.js', +] } + +1; diff --git a/t/map/tests.t b/t/map/tests.t index 1b152620e..f1f29dc06 100644 --- a/t/map/tests.t +++ b/t/map/tests.t @@ -12,6 +12,7 @@ my $requires = { 'Google' => 'map-google.js', 'GoogleOL' => 'map-google-ol.js', 'Hounslow' => 'map-wmts-hounslow.js', + 'IsleOfWight' => 'map-wmts-isleofwight.js', 'OSM' => 'OpenStreetMap.js', 'CycleMap' => 'OpenStreetMap.js', 'MapQuest' => 'OpenStreetMap.js', diff --git a/templates/web/isleofwight/about/mapterms.html b/templates/web/isleofwight/about/mapterms.html new file mode 100644 index 000000000..04c0aeb09 --- /dev/null +++ b/templates/web/isleofwight/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/templates/web/isleofwight/footer_extra_js.html b/templates/web/isleofwight/footer_extra_js.html index c43c49aef..f4385d98b 100644 --- a/templates/web/isleofwight/footer_extra_js.html +++ b/templates/web/isleofwight/footer_extra_js.html @@ -1,10 +1,9 @@ [% IF bodyclass.match('mappage'); scripts.push( version('/vendor/OpenLayers.Projection.OrdnanceSurvey.js'), + version('/cobrands/fixmystreet/assets.js'), version('/cobrands/fixmystreet-uk-councils/roadworks.js'), version('/cobrands/fixmystreet-uk-councils/js.js'), - version('/cobrands/fixmystreet/assets.js'), - version('/cobrands/highways/assets.js'), version('/cobrands/isleofwight/js.js'), ); END %] diff --git a/web/cobrands/isleofwight/base.scss b/web/cobrands/isleofwight/base.scss index c499b259f..aae8e9f7c 100644 --- a/web/cobrands/isleofwight/base.scss +++ b/web/cobrands/isleofwight/base.scss @@ -12,3 +12,7 @@ background: url(/cobrands/isleofwight/images/logo.gif) 0 50% no-repeat; background-size: 141px 38px; } + +#map_box #map { + background-color: white; +} diff --git a/web/js/map-wmts-isleofwight.js b/web/js/map-wmts-isleofwight.js new file mode 100644 index 000000000..464bee913 --- /dev/null +++ b/web/js/map-wmts-isleofwight.js @@ -0,0 +1,206 @@ +/* + * Maps for FMS using Island Roads' WMTS tile server + */ + +fixmystreet.maps.layer_bounds = new OpenLayers.Bounds( + 428576.1131782566, + 70608.46901095579, + 468137.51522498735, + 101069.6062942903 +); + +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": 140, + //"matrixHeight": 109 + //}, + //{ + //"identifier": 1, + //"scaleDenominator": 472471.18303754483, + //"supportedCRS": "urn:ogc:def:crs:EPSG:27700", + //"tileWidth": 256, + //"tileHeight": 256, + //"matrixWidth": 168, + //"matrixHeight": 130 + //}, + //{ + //"identifier": 2, + //"scaleDenominator": 377976.9464300358, + //"supportedCRS": "urn:ogc:def:crs:EPSG:27700", + //"tileWidth": 256, + //"tileHeight": 256, + //"matrixWidth": 210, + //"matrixHeight": 163 + //}, + //{ + //"identifier": 3, + //"scaleDenominator": 283482.7098225269, + //"supportedCRS": "urn:ogc:def:crs:EPSG:27700", + //"tileWidth": 256, + //"tileHeight": 256, + //"matrixWidth": 280, + //"matrixHeight": 217 + //}, + //{ + //"identifier": 4, + //"scaleDenominator": 188988.4732150179, + //"supportedCRS": "urn:ogc:def:crs:EPSG:27700", + //"tileWidth": 256, + //"tileHeight": 256, + //"matrixWidth": 420, + //"matrixHeight": 325 + //}, + { + "identifier": 5, + "scaleDenominator": 94494.23660750895, + "supportedCRS": "urn:ogc:def:crs:EPSG:27700", + "tileWidth": 256, + "tileHeight": 256, + "matrixWidth": 840, + "matrixHeight": 650 + }, + { + "identifier": 6, + "scaleDenominator": 70870.67745563173, + "supportedCRS": "urn:ogc:def:crs:EPSG:27700", + "tileWidth": 256, + "tileHeight": 256, + "matrixWidth": 1120, + "matrixHeight": 867 + }, + { + "identifier": 7, + "scaleDenominator": 47247.118303754476, + "supportedCRS": "urn:ogc:def:crs:EPSG:27700", + "tileWidth": 256, + "tileHeight": 256, + "matrixWidth": 1680, + "matrixHeight": 1300 + }, + { + "identifier": 8, + "scaleDenominator": 23623.559151877238, + "supportedCRS": "urn:ogc:def:crs:EPSG:27700", + "tileWidth": 256, + "tileHeight": 256, + "matrixWidth": 3360, + "matrixHeight": 2599 + }, + { + "identifier": 9, + "scaleDenominator": 9449.423660750896, + "supportedCRS": "urn:ogc:def:crs:EPSG:27700", + "tileWidth": 256, + "tileHeight": 256, + "matrixWidth": 8399, + "matrixHeight": 6496 + }, + { + "identifier": 10, + "scaleDenominator": 7559.538928600717, + "supportedCRS": "urn:ogc:def:crs:EPSG:27700", + "tileWidth": 256, + "tileHeight": 256, + "matrixWidth": 10499, + "matrixHeight": 8120 + }, + { + "identifier": 11, + "scaleDenominator": 5669.654196450538, + "supportedCRS": "urn:ogc:def:crs:EPSG:27700", + "tileWidth": 256, + "tileHeight": 256, + "matrixWidth": 13998, + "matrixHeight": 10826 + }, + { + "identifier": 12, + "scaleDenominator": 3779.7694643003583, + "supportedCRS": "urn:ogc:def:crs:EPSG:27700", + "tileWidth": 256, + "tileHeight": 256, + "matrixWidth": 20997, + "matrixHeight": 16239 + }, + { + "identifier": 13, + "scaleDenominator": 1889.8847321501792, + "supportedCRS": "urn:ogc:def:crs:EPSG:27700", + "tileWidth": 256, + "tileHeight": 256, + "matrixWidth": 41993, + "matrixHeight": 32478 + }, + { + "identifier": 14, + "scaleDenominator": 944.9423660750896, + "supportedCRS": "urn:ogc:def:crs:EPSG:27700", + "tileWidth": 256, + "tileHeight": 256, + "matrixWidth": 83985, + "matrixHeight": 64955 + }, + { + "identifier": 15, + "scaleDenominator": 377.9769464300358, + "supportedCRS": "urn:ogc:def:crs:EPSG:27700", + "tileWidth": 256, + "tileHeight": 256, + "matrixWidth": 209961, + "matrixHeight": 162387 + } +]; + +/* + * 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 >= 7) { + return 'normal'; + } else if (zoom >= 4) { + return 'small'; + } else { + return 'mini'; + } +}; + +fixmystreet.maps.selected_marker_size = function() { + var zoom = fixmystreet.map.getZoom() + fixmystreet.zoomOffset; + if (zoom >= 7) { + return 'big'; + } else if (zoom >= 4) { + return 'normal'; + } else { + return 'small'; + } +}; |