Skip to main content
1 of 2
minisaurus
  • 645
  • 1
  • 6
  • 18

OpenLayers 3 Geoserver GeoWebCache WMS tile alignment issue

I've started moving to OpenLayers 3 - very nice. One issue I have is with the dynamic tile size sent to my Geoserver - which is often 333.

This doesn't line up with the cache (which is 256 for EPSG:900913) so the Geoserver has to build a new tile - somewhat slow ...

Sometimes I get 256 (e.g. from Firefox on Linux) but usually it's off (e.g. Chrome on Linux, Android, Safari on iOS).

I've looked at a number of questions on this forum, and have gleaned that I might need to set a tileGrid, but how do I do this? Do I need to set resolutions on my map?

Here's my code:

var wms =   new ol.layer.Tile({
  source: new ol.source.TileWMS({
    url: '/geoserver/wms',
    params: {'LAYERS': 'test:wms_layer', 'TILED': true, },
    serverType: 'geoserver'
  })
});

var osm = new ol.layer.Tile({
  source: new ol.source.OSM()
});

var map = new ol.Map({
    target: 'map',
    layers: [
      osm,
      wms,
    ],
    view: new ol.View({
      center: ol.proj.transform([11.953, 57.757,], 'EPSG:4326', 'EPSG:3857'),
      zoom: 16,
    })
});

Any help appreciated, Mini

minisaurus
  • 645
  • 1
  • 6
  • 18