I have 2 TileWMS layers in my system which work well with some zoom levels and do not work with other zoom levels.

each non-working layer return this error: 400: X,Y values for the tile index were calculated to be {546.0380800062516, -354.8241599711327} which had to be rounded to {546, -355} and exceeds the threshold of 10%. Perhaps the client is using the wrong origin ?

the returned x,y values in the error message of each tile are different.

These two layers were working well with all zoom levels of openalerys 2. Also, I use the same resolutions array which I used with openlayers2.

other layer types are working well with the same projection and the same resolutions array in openalyers3

  • Do you have a live example people could look at? – erilem Nov 19 '14 at 7:15
  • I found the problem :) .. check the below answer – Mariam Malak Nov 19 '14 at 8:50

I found the problem :)

I must set tileGrid to ol.source.TileWMS.

var wmsSource = new ol.source.TileWMS({
    urls: geowebcacheURL,
    params: {
        'LAYERS': 'the layer',
        'SRS': projection,
        'FORMAT': 'image/gif',
        'TRANSPARENT': 'true'
    serverType: 'geoserver',
    tileGrid: new ol.tilegrid.XYZ({
        extent: [x1,y1,x2,y2],
        resolutions: [res1,res2, ...]

Openlayers3 builds custom resolutions array if you don't attach your array so tiles urls will have wrong bbox. openlayers2 was used the resolutions array of map options but openlayers3 does not do that and you must assign it for every TileWMS source

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.