[Geoserver-users] Geowebcache Direct integration with GeoServer WMS and SQLview

I configured my Geoserver with GeoWebCache direct integration as described here.

It works fine and the WMS tiles are cached as expected.

Though for one of my Geoserver layers it is not working. The layer has a SQL view: SELECT * FROM gs_selectpoly_private(‘%ids%’)
The id is passed to the Server via the viewparams. Geoserver does not cache anything for these layers. Is it simply not possible to cache a WMS with a viewparameter or do does it require any special setting?

Any help is appreciated!

Geoserver Build Information
Version2.5
Git Revision8cf3edcf5f61db010f7ad3fcb4613e7c0eabeaff
Build Date18-Mar-2014 16:08
GeoTools Version11.0 (rev fb9a2d3f88315d076523788cb8196ec89bb253f9)
GeoWebCache Version1.5.1 (rev 1.5.x/64246c20a4ada1c954b17d23b9447408d1c5432f)

Thanks,

Uli

You need to use a Parameter Filter to let GWC know which values to allow for caching. Each combination of possible parameters (Gridset, Format, Style, etc) leads to another cache so this is something to be careful about.

The GWC documentation on Parameter Filters is here: http://geowebcache.org/docs/1.5.1/configuration/layers/parameterfilters.html

The Tile Caching tab for the layer in GeoServer includes an editor that lets you add and modify filters.

Thanks Kevin for the information! Very helpful.

I got it to work with the viewparams settings. But for some reason it only
caches tiles from Zoom 0 to 8. Everything beyond zoom level 8 is not
cached. Do you have an idea by what that could be caused?

The gwc_layer xml file is the following:
LayerInfoImpl--410671f9_1454b70a3f4_-7ff8.xml
<GeoServerTileLayer>
  <id>LayerInfoImpl--410671f9:1454b70a3f4:-7ff8</id>
  <enabled>true</enabled>
  <name>mapicture:dt_private</name>
  <mimeFormats>
    <string>image/png</string>
  </mimeFormats>
  <gridSubsets>
    <gridSubset>
      <gridSetName>EPSG:3857</gridSetName>
      <extent>
        <coords>
          <double>1501560.1009329276</double>
          <double>-9047938.585667683</double>
          <double>5938789.2274691425</double>
          <double>7152392.93240148</double>
        </coords>
      </extent>
      <zoomStart>0</zoomStart>
      <zoomStop>18</zoomStop>
    </gridSubset>
  </gridSubsets>
  <metaWidthHeight>
    <int>4</int>
    <int>4</int>
  </metaWidthHeight>
  <expireCache>0</expireCache>
  <expireClients>0</expireClients>
  <parameterFilters>
    <stringParameterFilter>
      <key>VIEWPARAMS</key>
      <defaultValue>ids:208</defaultValue>
      <values>
        <string>ids:208</string>
      </values>
    </stringParameterFilter>
    <styleParameterFilter>
      <key>STYLES</key>
      <defaultValue></defaultValue>
      <availableStyles class="sorted-set"/>
      <defaultStyle>polygon</defaultStyle>
    </styleParameterFilter>
    <stringParameterFilter>
      <key>ENV</key>
      <defaultValue>v1:10;v2:20;v3:30</defaultValue>
      <values>
        <string>v1:10;v2:20;v3:30</string>
      </values>
    </stringParameterFilter>
  </parameterFilters>
  <gutter>0</gutter>
</GeoServerTileLayer>

*geowebcache.xml*
<?xml version="1.0" encoding="utf-8"?>
<gwcConfiguration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot;
xsi:schemaLocation="http://geowebcache.org/schema/1.6.0
http://geowebcache.org/schema/1.6.0/geowebcache.xsd&quot; xmlns="
http://geowebcache.org/schema/1.6.0&quot;&gt;
  <version>1.6.0</version>
  <backendTimeout>120</backendTimeout>
  <gridSets>
    <gridSet>
      <name>EPSG:3857</name>
      <srs>
        <number>3857</number>
      </srs>
      <extent>
        <coords>
          <double>-2.003750834E7</double>
          <double>-2.003750834E7</double>
          <double>2.003750834E7</double>
          <double>2.003750834E7</double>
        </coords>
      </extent>
      <alignTopLeft>false</alignTopLeft>
      <scaleDenominators>
        <double>5.590822639508929E8</double>
        <double>2.7954113197544646E8</double>
        <double>1.3977056598772323E8</double>
        <double>6.988528299386162E7</double>
        <double>3.494264149693081E7</double>
        <double>1.7471320748465404E7</double>
        <double>8735660.374232702</double>
        <double>4367830.187116351</double>
        <double>2183915.0935581755</double>
        <double>1091957.5467790877</double>
        <double>545978.7733895439</double>
        <double>272989.38669477194</double>
        <double>136494.69334738597</double>
        <double>68247.34667369298</double>
        <double>34123.67333684649</double>
        <double>17061.836668423246</double>
        <double>8530.918334211623</double>
        <double>4265.4591671058115</double>
        <double>2132.7295835529058</double>
        <double>1066.364791776453</double>
        <double>533.1823958882266</double>
      </scaleDenominators>
      <metersPerUnit>1.0</metersPerUnit>
      <pixelSize>2.8E-4</pixelSize>
      <scaleNames>
        <string>EPSG:3857:0</string>
        <string>EPSG:3857:1</string>
        <string>EPSG:3857:2</string>
        <string>EPSG:3857:3</string>
        <string>EPSG:3857:4</string>
        <string>EPSG:3857:5</string>
        <string>EPSG:3857:6</string>
        <string>EPSG:3857:7</string>
        <string>EPSG:3857:8</string>
        <string>EPSG:3857:9</string>
        <string>EPSG:3857:10</string>
        <string>EPSG:3857:11</string>
        <string>EPSG:3857:12</string>
        <string>EPSG:3857:13</string>
        <string>EPSG:3857:14</string>
        <string>EPSG:3857:15</string>
        <string>EPSG:3857:16</string>
        <string>EPSG:3857:17</string>
        <string>EPSG:3857:18</string>
        <string>EPSG:3857:19</string>
        <string>EPSG:3857:20</string>
      </scaleNames>
      <tileHeight>256</tileHeight>
      <tileWidth>256</tileWidth>
      <yCoordinateFirst>false</yCoordinateFirst>
    </gridSet>
  </gridSets>
  <layers/>
</gwcConfiguration>

On Thu, Jun 26, 2014 at 11:34 PM, Kevin Smith <ksmith@anonymised.com>
wrote:

You need to use a Parameter Filter to let GWC know which values to allow
for caching. Each combination of possible parameters (Gridset, Format,
Style, etc) leads to another cache so this is something to be careful about.

The GWC documentation on Parameter Filters is here:
http://geowebcache.org/docs/1.5.1/configuration/layers/parameterfilters.html

The Tile Caching tab for the layer in GeoServer includes an editor that
lets you add and modify filters.