[mapserver-dev] mapcache WMTS: offset on some zoom levels

Mathias Walker mwa at sourcepole.ch
Thu Sep 29 05:48:44 EDT 2011


Hello

While setting up a mapcache WMTS for EPSG:21781 I noticed that the tile data 
on some zoom levels is offset to the reference data when loading it with 
OpenLayers. If I load the same layer as mapcache TMS all zoom levels are 
correctly aligned.
Am I missing some configuration options or are there some issues in the WMTS 
calculation?

OpenLayers uses the same extent and resolutions as the mapcache config.
The following zoom levels are offset for WMTS in my setup:
(0 - 6 unknown) 7, 8, 9, 10, 12, 13, 14, 15, 17, 19, 24

Here are my settings:
 
mapcache.xml grid:

  <grid name="CH1903">
    <metadata>
      <title>CH1903 / LV03</title>
    </metadata>
    <srs>EPSG:21781</srs>
    <units>m</units>
    <extent>420000,30000,900000,350000</extent>
    <resolutions>4000,3750,3500,3250,3000,2750,2500,2250,2000,1750,1500,1250,1000,750,650,500,250,100,50,20,10,5,2.5,2,1.5,1,0.5</resolutions>
    <size>256 256</size>
  </grid>

OpenLayers:

  var options = {
    controls: [],
    projection: new OpenLayers.Projection("EPSG:21781"),
    units: "m",
    maxExtent:  new OpenLayers.Bounds.fromArray([420000,30000,900000,350000]),
    restrictedExtent:  new 
OpenLayers.Bounds.fromArray([420000,30000,900000,350000]),
    resolutions: 
[4000,3750,3500,3250,3000,2750,2500,2250,2000,1750,1500,1250,1000,750,650,500,250,100,50,20,10,5,2.5,2,1.5,1,0.5],
    allOverlays: false
  };
  var map = new OpenLayers.Map("map", options);

  map.addLayer( new OpenLayers.Layer.WMTS({
      name: "Bezirksgrenzen WMTS",
      url: "http://???.sourcepole.ch/mapcache/wmts/",
      layer: 'bezirksgrenzen',
      matrixSet: 'CH1903',
      format: 'image/png',
      style: 'default',
      buffer:0,
      isBaseLayer:false,
      maxExtent: new OpenLayers.Bounds(420000,30000,900000,350000)
    }
  ));

  map.addLayer( new OpenLayers.Layer.TMS(
    "Bezirksgrenzen TMS",
    "http://???.sourcepole.ch/mapcache/tms",
    {
      layername: "bezirksgrenzen",
      type: "png",
      isBaseLayer: false,
      buffer: 0,
      visibility: true
    }
  ));


Best regards
Mathias Walker
-- 
Sourcepole - Linux & Open Source Solutions
Churerstrasse 22, 8808 Pfäffikon SZ, Switzerland
Tel: 044 440 77 11  Fax: 044 440 77 12
mwa at sourcepole.ch  http://www.sourcepole.ch


More information about the mapserver-dev mailing list