diff options
author | Struan Donald <struan@exo.org.uk> | 2020-07-16 16:46:35 +0100 |
---|---|---|
committer | Struan Donald <struan@exo.org.uk> | 2020-09-18 15:16:40 +0100 |
commit | 20f7e0da39cb057efea6c3774c0f7d5436ff709c (patch) | |
tree | d9fd7119099a96da10890f29c11c892aff215f95 /web | |
parent | c8e76112038ded4f03cc9a8caea4dbb8a91982a6 (diff) |
[AlloyV2] update asset fetching code
change resolution and zoom level for asset layers
Diffstat (limited to 'web')
-rw-r--r-- | web/cobrands/fixmystreet-uk-councils/alloy.js | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/web/cobrands/fixmystreet-uk-councils/alloy.js b/web/cobrands/fixmystreet-uk-councils/alloy.js index 88d0b017f..a06c197fe 100644 --- a/web/cobrands/fixmystreet-uk-councils/alloy.js +++ b/web/cobrands/fixmystreet-uk-councils/alloy.js @@ -4,6 +4,7 @@ OpenLayers.Protocol.Alloy = OpenLayers.Class(OpenLayers.Protocol.HTTP, { currentRequests: [], tileSize: 512, + resolution: 2.388657133579254, abort: function() { if (this.currentRequests.length) { for (var j = 0; j < this.currentRequests.length; j++) { @@ -56,14 +57,11 @@ OpenLayers.Protocol.Alloy = OpenLayers.Class(OpenLayers.Protocol.HTTP, { getTileCoord: function(bounds, maxExtent, map, reverse) { var origin = new OpenLayers.LonLat(maxExtent.left, maxExtent.top); - // hard code this number as we want to avoid fetching asset groups - // which happens at more zoomed out levels - var resolution = 2.388657133579254; var adjustX = reverse ? 0.5 : 0; var adjustY = reverse ? 0 : 0.5; - var xFromOrigin = Math.floor((bounds[0] - origin.lon) / resolution + adjustX); - var yFromOrigin = Math.floor((bounds[1] - origin.lat) / resolution + adjustY); + var xFromOrigin = Math.floor((bounds[0] - origin.lon) / this.resolution + adjustX); + var yFromOrigin = Math.floor((bounds[1] - origin.lat) / this.resolution + adjustY); var tileCoordX = Math.floor(xFromOrigin / this.tileSize); var tileCoordY = Math.floor(yFromOrigin / this.tileSize) * -1; @@ -169,8 +167,9 @@ OpenLayers.Format.AlloyV2 = OpenLayers.Class(OpenLayers.Format.GeoJSON, { OpenLayers.Protocol.AlloyV2 = OpenLayers.Class(OpenLayers.Protocol.Alloy, { tileSize: 128, + resolution: 4.777314267158508, getURL: function(coords, options) { - return OpenLayers.String.format(options.base, {'layerid': options.layerid, 'styleid': options.styleid, 'z': 17, 'x': coords[0], 'y': coords[1]}); + return OpenLayers.String.format(options.base, {'layerid': options.layerid, 'styleid': options.styleid, 'z': 16, 'x': coords[0], 'y': coords[1]}); } }); |