{"action":"closed","issue":{"url":"https://api.github.com/repos/openlayers/ol3/issues/6216","repository_url":"https://api.github.com/repos/openlayers/ol3","labels_url":"https://api.github.com/repos/openlayers/ol3/issues/6216/labels{/name}","comments_url":"https://api.github.com/repos/openlayers/ol3/issues/6216/comments","events_url":"https://api.github.com/repos/openlayers/ol3/issues/6216/events","html_url":"https://github.com/openlayers/ol3/issues/6216","id":193980716,"number":6216,"title":"Tile grid incorrect with pixelratio=3 using Geoserver/Geowebcache as backend","user":{"login":"TommasoDb","id":11291183,"avatar_url":"https://avatars.githubusercontent.com/u/11291183?v=3","gravatar_id":"","url":"https://api.github.com/users/TommasoDb","html_url":"https://github.com/TommasoDb","followers_url":"https://api.github.com/users/TommasoDb/followers","following_url":"https://api.github.com/users/TommasoDb/following{/other_user}","gists_url":"https://api.github.com/users/TommasoDb/gists{/gist_id}","starred_url":"https://api.github.com/users/TommasoDb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TommasoDb/subscriptions","organizations_url":"https://api.github.com/users/TommasoDb/orgs","repos_url":"https://api.github.com/users/TommasoDb/repos","events_url":"https://api.github.com/users/TommasoDb/events{/privacy}","received_events_url":"https://api.github.com/users/TommasoDb/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-12-07T07:54:11Z","updated_at":"2016-12-07T08:04:38Z","closed_at":"2016-12-07T08:04:38Z","body":"I'm developing a small webmap using Openlayers3 and geoserver/geowebcache as backend. \r\nMy goal is to support browsers/displays with pixelratio=1, pixelratio=2 and pixelratio=3.\r\nFor that I defined in geoserver backend 3 gridsets with tiles sizes 256x256, 512x512 and 768x768. \r\nI assume that:\r\n* pixelratio=1 requires a gridset with tiles sizes 256x256\r\n* pixelratio=2 requires a gridset with tiles sizes 512x512\r\n* pixelratio=3 requires a gridset with tiles sizes 768x768\r\n\r\nNow, my code is working only for pixelratio=1 and pixelratio=2.\r\nBut if pixelratio=3 geowebcache returns a error:\r\n```\r\ngeowebcache-cache-result:MISS\r\ngeowebcache-miss-reason:request does not align to grid(s) 'grid_512' 'grid_768' 'grid_256'\r\n```\r\nIf pixelratio=3 Openlayers generates such a URL:\r\n`http://localhost:8082/wms?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&FORMAT=image%2Fpng&TRANSPARENT=false&layers=mfn_mwb17%3Amfn_mwb17_0_basemap&TILED=true&WIDTH=768&HEIGHT=768&SRS=EPSG%3A32632&STYLES=&FORMAT_OPTIONS=dpi%3A270&BBOX=536964.8438079988%2C5280880.182948656%2C537609.9638079988%2C5281525.3029486565`\r\nOpenalayers changes the tiles sizes to 768x768 and DPI to 270 but apparently does not calculate correctly the grid.\r\nThe demo map in Geoserver (based on Openlayers2) works with all 3 grid sets.\r\nI'm using geoserver 2.10 and google chrome.\r\nThis is my code so far. Resolutions and bounds are the same for all 3 grid sets in backend. Any help is appreciated:\r\n```<!DOCTYPE html>\r\n<html>\r\n<head>\r\n    <title>WMS Tiles</title>\r\n    <link rel=\"stylesheet\" href=\"https://openlayers.org/en/v3.19.1/css/ol.css\" type=\"text/css\">\r\n    <!-- The line below is only needed for old environments like Internet Explorer and Android 4.x -->\r\n    <script src=\"https://cdn.polyfill.io/v2/polyfill.min.js?features=requestAnimationFrame,Element.prototype.classList,URL\"></script>\r\n    <script src=\"https://openlayers.org/en/v3.19.1/build/ol.js\"></script>\r\n</head>\r\n<body>\r\n<div id=\"map\" class=\"map\"></div>\r\n<script>\r\n    console.log(\"DOMContentLoaded\");\r\n    try {\r\n        var config = {\r\n            \"bounds\": {\r\n                \"left\": 536319.7238079988,\r\n                \"bottom\": 5278944.822948656,\r\n                \"right\": 540150.3790103362,\r\n                \"top\": 5282223.663765706\r\n            }\r\n        };\r\n\r\n        var bounds = [config.bounds.left, config.bounds.bottom, config.bounds.right, config.bounds.top];\r\n        var resolutions = [2.5199999999999996,\r\n            1.2599999999999998,\r\n            0.6299999999999999,\r\n            0.31499999999999995,\r\n            0.15749999999999997,\r\n            0.07874999999999999,\r\n            0.03937499999999999\r\n        ];\r\n\r\n        var projection = new ol.proj.Projection({\r\n            code: 'EPSG:32632'\r\n        });\r\n\r\n        var params = {\r\n            'VERSION': '1.1.1',\r\n            'layers': \"mfn_mwb17:mfn_mwb17_0_basemap\",\r\n            'TILED': true,\r\n            'TRANSPARENT': false\r\n        };\r\n\r\n        var tileGrid = new ol.tilegrid.TileGrid({\r\n            extent: bounds,\r\n            resolutions: resolutions,\r\n            origin: [config.bounds.left, config.bounds.bottom],\r\n            tileSize: [256, 256]\r\n        });\r\n        var view = new ol.View({\r\n            zoom: 0,\r\n            center: ol.extent.getCenter(bounds),\r\n            projection: projection,\r\n            resolutions: resolutions\r\n        });\r\n\r\n        var map = new ol.Map({\r\n            controls: ol.control.defaults(\r\n                {\r\n                    rotate: false,\r\n                    attributionOptions: {\r\n                        collapsible: false\r\n                    }\r\n                }\r\n            ),\r\n            view: view,\r\n            layers: [\r\n                new ol.layer.Tile({\r\n                    source: new ol.source.TileWMS({\r\n                        url: \"http://localhost:8082/wms\",\r\n                        params: params,\r\n                        tileGrid: tileGrid,\r\n                        serverType: 'geoserver'\r\n                    }),\r\n                    projection: projection,\r\n                    extend: bounds\r\n                })\r\n            ],\r\n            target: 'map'\r\n        });\r\n        console.log(\"no error\");\r\n    } catch (error) {\r\n        console.log(\"error\");\r\n        console.log(error);\r\n    }\r\n</script>\r\n</body>\r\n</html>\r\n\r\n```\r\n\r\n"}}
{"actor":{"display_login":"ahocevar"}}