From 196e3cafcfcec0cc1a050a9d07aad81156ee794e Mon Sep 17 00:00:00 2001 From: Matthew Somerville Date: Thu, 9 Jul 2020 17:38:00 +0100 Subject: Use up-to-date Bing map URLs. --- web/js/map-bing-ol.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'web/js/map-bing-ol.js') diff --git a/web/js/map-bing-ol.js b/web/js/map-bing-ol.js index 4e01ff58b..a99fdd849 100644 --- a/web/js/map-bing-ol.js +++ b/web/js/map-bing-ol.js @@ -14,6 +14,7 @@ fixmystreet.maps.config = function() { }; OpenLayers.Layer.Bing = OpenLayers.Class(OpenLayers.Layer.XYZ, { + tile_base: '//t{S}.ssl.ak.dynamic.tiles.virtualearth.net/comp/ch/${id}?mkt=en-US&it=G,L&src=t&shading=hill&og=969&n=z', attributionTemplate: '${logo}${copyrights}', setMap: function() { @@ -35,7 +36,8 @@ OpenLayers.Layer.Bing = OpenLayers.Class(OpenLayers.Layer.XYZ, { }, updateAttribution: function() { - var copyrights = '© 2011 Microsoft. © AND, Navteq'; + var year = (new Date()).getFullYear(); + var copyrights = '© ' + year + ' Microsoft, HERE'; var logo = ''; this._updateAttribution(copyrights, logo); }, @@ -89,12 +91,11 @@ OpenLayers.Layer.Bing = OpenLayers.Class(OpenLayers.Layer.XYZ, { }, get_urls: function(bounds, z) { - return [ - "//ecn.t0.tiles.virtualearth.net/tiles/r${id}.png?g=6570", - "//ecn.t1.tiles.virtualearth.net/tiles/r${id}.png?g=6570", - "//ecn.t2.tiles.virtualearth.net/tiles/r${id}.png?g=6570", - "//ecn.t3.tiles.virtualearth.net/tiles/r${id}.png?g=6570" - ]; + var urls = []; + for (var i=0; i<4; i++) { + urls.push(this.tile_base.replace('{S}', i)); + } + return urls; }, CLASS_NAME: "OpenLayers.Layer.Bing" -- cgit v1.2.3 From 009c42448270895f97302747a69485de432d537d Mon Sep 17 00:00:00 2001 From: Struan Donald Date: Tue, 19 May 2020 17:02:50 +0100 Subject: Add aerial view toggle to Bing Maps & subclasses. Co-authored-by: Dave Arter Co-authored-by: Matthew Somerville --- web/js/map-bing-ol.js | 43 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) (limited to 'web/js/map-bing-ol.js') diff --git a/web/js/map-bing-ol.js b/web/js/map-bing-ol.js index a99fdd849..bbaf22940 100644 --- a/web/js/map-bing-ol.js +++ b/web/js/map-bing-ol.js @@ -10,9 +10,21 @@ fixmystreet.maps.config = function() { if ( fixmystreet.page == 'report' ) { fixmystreet.controls.push( new OpenLayers.Control.PermalinkFMS('key-tool-problems-nearby', '/around') ); } - fixmystreet.map_type = OpenLayers.Layer.Bing; }; +(function() { + $(function(){ + $('#map_layer_toggle').toggle(function(){ + $(this).text('Roads'); + fixmystreet.map.setBaseLayer(fixmystreet.map.layers[1]); + }, function(){ + $(this).text('Aerial'); + fixmystreet.map.setBaseLayer(fixmystreet.map.layers[0]); + }); + }); + +})(); + OpenLayers.Layer.Bing = OpenLayers.Class(OpenLayers.Layer.XYZ, { tile_base: '//t{S}.ssl.ak.dynamic.tiles.virtualearth.net/comp/ch/${id}?mkt=en-US&it=G,L&src=t&shading=hill&og=969&n=z', attributionTemplate: '${logo}${copyrights}', @@ -100,3 +112,32 @@ OpenLayers.Layer.Bing = OpenLayers.Class(OpenLayers.Layer.XYZ, { CLASS_NAME: "OpenLayers.Layer.Bing" }); + +OpenLayers.Layer.BingAerial = OpenLayers.Class(OpenLayers.Layer.Bing, { + tile_base: '//t{S}.ssl.ak.dynamic.tiles.virtualearth.net/comp/ch/${id}?mkt=en-US&it=A,G,L&src=t&og=969&n=z', + + setMap: function() { + OpenLayers.Layer.Bing.prototype.setMap.apply(this, arguments); + this.map.events.register("moveend", this, this.updateAttribution); + }, + + updateAttribution: function() { + var z = this.map.getZoom() + this.zoomOffset; + var year = (new Date()).getFullYear(); + var copyrights = '© ' + year + ' Microsoft, HERE, '; + if (z >= 13) { + copyrights += 'Maxar, CNES Distribution Airbus DS'; + } else { + copyrights += 'Earthstar Geographics SIO'; + } + var logo = ''; + this._updateAttribution(copyrights, logo); + }, + + CLASS_NAME: "OpenLayers.Layer.BingAerial" +}); + +fixmystreet.layer_options = [ + { map_type: OpenLayers.Layer.Bing }, + { map_type: OpenLayers.Layer.BingAerial } +]; -- cgit v1.2.3 From c3313f7206e832a7e78890b21372cdf72bdf70ad Mon Sep 17 00:00:00 2001 From: Matthew Somerville Date: Tue, 14 Jul 2020 09:23:21 +0100 Subject: Make aerial/roads translatable in JavaScript. --- web/js/map-bing-ol.js | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'web/js/map-bing-ol.js') diff --git a/web/js/map-bing-ol.js b/web/js/map-bing-ol.js index bbaf22940..a329c4235 100644 --- a/web/js/map-bing-ol.js +++ b/web/js/map-bing-ol.js @@ -14,15 +14,10 @@ fixmystreet.maps.config = function() { (function() { $(function(){ - $('#map_layer_toggle').toggle(function(){ - $(this).text('Roads'); - fixmystreet.map.setBaseLayer(fixmystreet.map.layers[1]); - }, function(){ - $(this).text('Aerial'); - fixmystreet.map.setBaseLayer(fixmystreet.map.layers[0]); + $(this).text(translation_strings.map_roads); + $(this).text(translation_strings.map_aerial); }); }); - })(); OpenLayers.Layer.Bing = OpenLayers.Class(OpenLayers.Layer.XYZ, { -- cgit v1.2.3 From eed6158981240afce10824e82fa86f14b38f3167 Mon Sep 17 00:00:00 2001 From: Matthew Somerville Date: Tue, 14 Jul 2020 09:24:02 +0100 Subject: Remove use of jQuery toggle(). --- web/js/map-bing-ol.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'web/js/map-bing-ol.js') diff --git a/web/js/map-bing-ol.js b/web/js/map-bing-ol.js index a329c4235..b0e5dfc6a 100644 --- a/web/js/map-bing-ol.js +++ b/web/js/map-bing-ol.js @@ -14,8 +14,16 @@ fixmystreet.maps.config = function() { (function() { $(function(){ - $(this).text(translation_strings.map_roads); - $(this).text(translation_strings.map_aerial); + $('#map_layer_toggle').click(function(e) { + e.preventDefault(); + var $this = $(this); + if ($this.text() == translation_strings.map_aerial) { + $this.text(translation_strings.map_roads); + fixmystreet.map.setBaseLayer(fixmystreet.map.layers[1]); + } else { + $this.text(translation_strings.map_aerial); + fixmystreet.map.setBaseLayer(fixmystreet.map.layers[0]); + } }); }); })(); -- cgit v1.2.3 From d55461e6d05ab0c1b398f756a687107a5ce6d49e Mon Sep 17 00:00:00 2001 From: Matthew Somerville Date: Thu, 16 Jul 2020 14:26:13 +0100 Subject: Default to aerial map in JS if aerial given in URL. --- web/js/map-bing-ol.js | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'web/js/map-bing-ol.js') diff --git a/web/js/map-bing-ol.js b/web/js/map-bing-ol.js index b0e5dfc6a..179238633 100644 --- a/web/js/map-bing-ol.js +++ b/web/js/map-bing-ol.js @@ -25,6 +25,10 @@ fixmystreet.maps.config = function() { fixmystreet.map.setBaseLayer(fixmystreet.map.layers[0]); } }); + // If page loaded with Aerial as starting, rather than default road + if ($('#map_layer_toggle').text() == translation_strings.map_roads) { + fixmystreet.map.setBaseLayer(fixmystreet.map.layers[1]); + } }); })(); -- cgit v1.2.3 From e268e2b893aaf8a99e457c085e9c77d140b77233 Mon Sep 17 00:00:00 2001 From: M Somerville Date: Thu, 13 Aug 2020 21:15:08 +0100 Subject: Allow one more zoom level on most map types. Not on StreetView/OpenMap Local based, which are not available. --- web/js/map-bing-ol.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'web/js/map-bing-ol.js') diff --git a/web/js/map-bing-ol.js b/web/js/map-bing-ol.js index 179238633..c44cf96f8 100644 --- a/web/js/map-bing-ol.js +++ b/web/js/map-bing-ol.js @@ -66,7 +66,7 @@ OpenLayers.Layer.Bing = OpenLayers.Class(OpenLayers.Layer.XYZ, { options = OpenLayers.Util.extend({ /* Below line added to OSM's file in order to allow minimum zoom level */ maxResolution: 156543.03390625/Math.pow(2, options.zoomOffset || 0), - numZoomLevels: 19, + numZoomLevels: 20, sphericalMercator: true, buffer: 0 }, options); -- cgit v1.2.3