deegree / deegree3

Official deegree repository providing geospatial core libraries, data access and advanced OGC web service implementations
https://www.deegree.org
GNU Lesser General Public License v2.1
146 stars 100 forks source link

WMTS is broken for GetTile requests against local FileSystemTileStore created with tilecache #487

Open tfr42 opened 9 years ago

tfr42 commented 9 years ago

Actual in all deegree 3.4 pre-releases after pre10 any GetTile requests against local FileSystemTileStore created with tilecache returns a "Tile does not exists" error. This was caused by PR ​#251. By rolling back this PR the indended behaviour can be restored. Expected is that the behaviour remains the same as in the pre10 and earlier releases and PR #251 is reworked or reverted. Test Setup: We are using http://tilecache.org/ to create a directory structure on the local filesystem which contain the TMS.

The configuration file tilecache.cfg contains the following parameters:

[cache]
type=Disk
base=/tmp
[basemap]
type=WMSLayer
url=http://localhost:8080/basemap
layers=0,2,3,4,5,7,8,10,11
extension=png
debug=no

and start the seeding with ./tilecache_seed.py basemap 0 11

see http://tilecache.org/docs/README.html#configuration for more information.

The deegree WMTS is configured with FileSystemTileStore:

<FileSystemTileStore ... configVersion="3.2.0">
  <TileDataSet>
    <Identifier>basemap</Identifier>
    <TileMatrixSetId>InspireCrs84Quad</TileMatrixSetId>
    <TileCacheDiskLayout>
      <LayerDirectory>/tmp/basemap</LayerDirectory>
      <FileType>png</FileType>
    </TileCacheDiskLayout>
  </TileDataSet>
</FileSystemTileStore>

and the TileMatrixSet:

<TileMatrixSet xmlns="http://www.deegree.org/datasource/tile/tilematrixset" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.deegree.org/datasource/tile/tilematrixset http://schemas.deegree.org/datasource/tile/tilematrixset/3.2.0/tilematrixset.xsd"
  configVersion="3.2.0">

  <CRS>urn:ogc:def:crs:OGC:1.3:CRS84</CRS>

  <TileMatrix>
    <Identifier>0</Identifier>
    <ScaleDenominator>279541132.0143589</ScaleDenominator>
    <TopLeftCorner>-180 90</TopLeftCorner>
    <TileWidth>256</TileWidth>
    <TileHeight>256</TileHeight>
    <MatrixWidth>2</MatrixWidth>
    <MatrixHeight>1</MatrixHeight>
  </TileMatrix>
  <TileMatrix>
    <Identifier>1</Identifier>
    <ScaleDenominator>139770566.0071794</ScaleDenominator>
    <TopLeftCorner>-180 90</TopLeftCorner>
    <TileWidth>256</TileWidth>
    <TileHeight>256</TileHeight>
    <MatrixWidth>4</MatrixWidth>
    <MatrixHeight>2</MatrixHeight>
  </TileMatrix>
  <TileMatrix>
    <Identifier>2</Identifier>
    <ScaleDenominator>69885283.00358972</ScaleDenominator>
    <TopLeftCorner>-180 90</TopLeftCorner>
    <TileWidth>256</TileWidth>
    <TileHeight>256</TileHeight>
    <MatrixWidth>8</MatrixWidth>
    <MatrixHeight>4</MatrixHeight>
  </TileMatrix>
  <TileMatrix>
    <Identifier>3</Identifier>
    <ScaleDenominator>34942641.50179486</ScaleDenominator>
    <TopLeftCorner>-180 90</TopLeftCorner>
    <TileWidth>256</TileWidth>
    <TileHeight>256</TileHeight>
    <MatrixWidth>16</MatrixWidth>
    <MatrixHeight>8</MatrixHeight>
  </TileMatrix>
  <TileMatrix>
    <Identifier>4</Identifier>
    <ScaleDenominator>17471320.75089743</ScaleDenominator>
    <TopLeftCorner>-180 90</TopLeftCorner>
    <TileWidth>256</TileWidth>
    <TileHeight>256</TileHeight>
    <MatrixWidth>32</MatrixWidth>
    <MatrixHeight>16</MatrixHeight>
  </TileMatrix>
  <TileMatrix>
    <Identifier>5</Identifier>
    <ScaleDenominator>8735660.375448715</ScaleDenominator>
    <TopLeftCorner>-180 90</TopLeftCorner>
    <TileWidth>256</TileWidth>
    <TileHeight>256</TileHeight>
    <MatrixWidth>64</MatrixWidth>
    <MatrixHeight>32</MatrixHeight>
  </TileMatrix>
  <TileMatrix>
    <Identifier>6</Identifier>
    <ScaleDenominator>4367830.187724357</ScaleDenominator>
    <TopLeftCorner>-180 90</TopLeftCorner>
    <TileWidth>256</TileWidth>
    <TileHeight>256</TileHeight>
    <MatrixWidth>128</MatrixWidth>
    <MatrixHeight>64</MatrixHeight>
  </TileMatrix>
  <TileMatrix>
    <Identifier>7</Identifier>
    <ScaleDenominator>2183915.093862179</ScaleDenominator>
    <TopLeftCorner>-180 90</TopLeftCorner>
    <TileWidth>256</TileWidth>
    <TileHeight>256</TileHeight>
    <MatrixWidth>256</MatrixWidth>
    <MatrixHeight>128</MatrixHeight>
  </TileMatrix>
  <TileMatrix>
    <Identifier>8</Identifier>
    <ScaleDenominator>1091957.546931089</ScaleDenominator>
    <TopLeftCorner>-180 90</TopLeftCorner>
    <TileWidth>256</TileWidth>
    <TileHeight>256</TileHeight>
    <MatrixWidth>512</MatrixWidth>
    <MatrixHeight>256</MatrixHeight>
  </TileMatrix>
  <TileMatrix>
    <Identifier>9</Identifier>
    <ScaleDenominator>545978.7734655447</ScaleDenominator>
    <TopLeftCorner>-180 90</TopLeftCorner>
    <TileWidth>256</TileWidth>
    <TileHeight>256</TileHeight>
    <MatrixWidth>1024</MatrixWidth>
    <MatrixHeight>512</MatrixHeight>
  </TileMatrix>
  <TileMatrix>
    <Identifier>10</Identifier>
    <ScaleDenominator>272989.3867327723</ScaleDenominator>
    <TopLeftCorner>-180 90</TopLeftCorner>
    <TileWidth>256</TileWidth>
    <TileHeight>256</TileHeight>
    <MatrixWidth>2048</MatrixWidth>
    <MatrixHeight>1024</MatrixHeight>
  </TileMatrix>
  <TileMatrix>
    <Identifier>11</Identifier>
    <ScaleDenominator>136494.6933663862</ScaleDenominator>
    <TopLeftCorner>-180 90</TopLeftCorner>
    <TileWidth>256</TileWidth>
    <TileHeight>256</TileHeight>
    <MatrixWidth>4096</MatrixWidth>
    <MatrixHeight>2048</MatrixHeight>
  </TileMatrix>
  <TileMatrix>
    <Identifier>12</Identifier>
    <ScaleDenominator>68247.34668319309</ScaleDenominator>
    <TopLeftCorner>-180 90</TopLeftCorner>
    <TileWidth>256</TileWidth>
    <TileHeight>256</TileHeight>
    <MatrixWidth>8192</MatrixWidth>
    <MatrixHeight>4096</MatrixHeight>
  </TileMatrix>
  <TileMatrix>
    <Identifier>13</Identifier>
    <ScaleDenominator>34123.67334159654</ScaleDenominator>
    <TopLeftCorner>-180 90</TopLeftCorner>
    <TileWidth>256</TileWidth>
    <TileHeight>256</TileHeight>
    <MatrixWidth>16384</MatrixWidth>
    <MatrixHeight>8192</MatrixHeight>
  </TileMatrix>
  <TileMatrix>
    <Identifier>14</Identifier>
    <ScaleDenominator>17061.83667079827</ScaleDenominator>
    <TopLeftCorner>-180 90</TopLeftCorner>
    <TileWidth>256</TileWidth>
    <TileHeight>256</TileHeight>
    <MatrixWidth>32768</MatrixWidth>
    <MatrixHeight>16384</MatrixHeight>
  </TileMatrix>
  <TileMatrix>
    <Identifier>15</Identifier>
    <ScaleDenominator>8530.918335399136</ScaleDenominator>
    <TopLeftCorner>-180 90</TopLeftCorner>
    <TileWidth>256</TileWidth>
    <TileHeight>256</TileHeight>
    <MatrixWidth>65536</MatrixWidth>
    <MatrixHeight>32768</MatrixHeight>
  </TileMatrix>
  <TileMatrix>
    <Identifier>16</Identifier>
    <ScaleDenominator>4265.459167699568</ScaleDenominator>
    <TopLeftCorner>-180 90</TopLeftCorner>
    <TileWidth>256</TileWidth>
    <TileHeight>256</TileHeight>
    <MatrixWidth>131072</MatrixWidth>
    <MatrixHeight>65536</MatrixHeight>
  </TileMatrix>
  <TileMatrix>
    <Identifier>17</Identifier>
    <ScaleDenominator>2132.729583849784</ScaleDenominator>
    <TopLeftCorner>-180 90</TopLeftCorner>
    <TileWidth>256</TileWidth>
    <TileHeight>256</TileHeight>
    <MatrixWidth>262144</MatrixWidth>
    <MatrixHeight>131072</MatrixHeight>
  </TileMatrix>

</TileMatrixSet>

The GetTile request: ​http://localhost:8080/deegree-wmts-basemap/services/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=basemap&STYLE=default&FORMAT=image/png&TILEMATRIXSET=InspireCrs84Quad&TILEMATRIX=0&TILEROW=0&TILECOL=0

MrSnyder commented 9 years ago

The idea of PR #251 was simply to provide a consistent behavior for organizing the tile levels internally, as not all providers (e.g. the GdalTileDataSetBuilder) construct DefaultTileDataSet() with the levels ordered by resolution. That's why I believe it's a good idea to guarantee the order in the constructor itself.

A positive run-time effect is that before the patch, tile levels had to be ordered for every call to #getTiles( Envelope envelope, double resolution ). After the patch, they are only ordered once on construction.

I still fail to see, how the patch causes the observed problem. Can you provide a full configuration (including the tile directory) for easy observing of the effect? Probably, you can limit the extent and the number of levels to shrink it to a reasonable size.