0

I'm finding an unexpected behavior when setting alignTopLeft=true at geowebcache.xml for a gridSet. When I am navigating on the map within the same cache level everything works fine (even zooming in/out works fine). However, when the map changes to a different cache level, I am taken vertically to a different location, as if there was a different y-offset for each cache level. This behavior has been observed with both OpenLayers and QGIS. I believe it has to do with the fact that when alignTopLeft=false you get different tile origins for each cache level, while when alignTopLeft=true, despite the fact that now you get the same tile origin for all cache levels, somehow the service is internally still using different tile origins and it doesn't work properly is you use the same single one. More details below.

At GeoServer (both 2.13.1 and 2.15), I have configured tile caching on a layer with the formats "image/png" and "application/x-protobuf;type=mapbox-vector", and assigned the following gridSet to it:

<gridSet>
  <name>JAVIER:EPSG:2157</name>
  <description>Test</description>
  <srs>
    <number>2157</number>
  </srs>
  <extent>
    <coords>
      <double>421849.8127979373</double>
      <double>515251.5940062995</double>
      <double>785108.0954014773</double>
      <double>968015.3873920501</double>
    </coords>
  </extent>
  <alignTopLeft>false</alignTopLeft>
  <resolutions>
    <double>1120.0</double>
    <double>140.0</double>
    <double>14.0</double>
  </resolutions>
  <metersPerUnit>1.0</metersPerUnit>
  <pixelSize>2.8E-4</pixelSize>
  <scaleNames>
    <string>JAVIER:EPSG:2157:0</string>
    <string>JAVIER:EPSG:2157:1</string>
    <string>JAVIER:EPSG:2157:2</string>
  </scaleNames>
  <tileHeight>256</tileHeight>
  <tileWidth>256</tileWidth>
  <yCoordinateFirst>false</yCoordinateFirst>
</gridSet>

When requesting the capabilities of the GeoWebCache WMTS service, I am getting the following TileMatrixSet, which has a different tile origin (TopLeftCorner) for each cache level.

<TileMatrixSet>
  <ows:Identifier>JAVIER:EPSG:2157</ows:Identifier>
  <ows:SupportedCRS>urn:ogc:def:crs:EPSG::2157</ows:SupportedCRS>
  <TileMatrix>
    <ows:Identifier>JAVIER:EPSG:2157:0</ows:Identifier>
    <ScaleDenominator>4000000.0000000005</ScaleDenominator>
    <TopLeftCorner>421849.8127979373 1088692.0</TopLeftCorner>
    <TileWidth>256</TileWidth>
    <TileHeight>256</TileHeight>
    <MatrixWidth>2</MatrixWidth>
    <MatrixHeight>2</MatrixHeight>
  </TileMatrix>
  <TileMatrix>
    <ows:Identifier>JAVIER:EPSG:2157:1</ows:Identifier>
    <ScaleDenominator>500000.00000000006</ScaleDenominator>
    <TopLeftCorner>421849.8127979373 981172.0</TopLeftCorner>
    <TileWidth>256</TileWidth>
    <TileHeight>256</TileHeight>
    <MatrixWidth>11</MatrixWidth>
    <MatrixHeight>13</MatrixHeight>
  </TileMatrix>
  <TileMatrix>
    <ows:Identifier>JAVIER:EPSG:2157:2</ows:Identifier>
    <ScaleDenominator>50000.00000000001</ScaleDenominator>
    <TopLeftCorner>421849.8127979373 970420.0</TopLeftCorner>
    <TileWidth>256</TileWidth>
    <TileHeight>256</TileHeight>
    <MatrixWidth>102</MatrixWidth>
    <MatrixHeight>127</MatrixHeight>
  </TileMatrix>
</TileMatrixSet>

With the configuration above, everything works fine. I get both WMTS and Vector Tile layers working fine on OpenLayers, and the WMTS service works fine in QGIS. However, having multiple tile origins causes me other issues and I'm trying to configure/force the use of a single tile origin (same for all cache levels). With that in mind, I changed to

<alignTopLeft>true</alignTopLeft>

on geowebcache.xml, and that successfully makes all tile origins (TopLeftCorners) be the same on the WMTS capabilities description, that is the top left corner of the SRS: [421849.8127979373 968015.3873920501]. However, with this new configuration the layer doesn't behave properly when displayed neither in OpenLayers nor in QGIS, where you find different y-offsets for each cache level while navigating on the map, and you are taken vertically to different locations whenever the cache level changes.

I can confirm that the vector tile layer works again properly in OpenLayers if I use the same collection of different tile origins associated to alignTopLeft=false instead of the same tile origin associated to alignTopLeft=true, even when alignTopLeft=true is set. So, it looks like despite alignTopLeft=true makes all tile origins be the same, in reality the service won't work properly unless you still use the collection of different tile origins obtained when alignTopLeft=false.

Can someone help, please?

Your Answer

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

Browse other questions tagged or ask your own question.