Search code examples
openlayersgeoserver

GeoWebCache with viewparam for WMS layer


I'm new to Geowebcache. I'm trying to use build in Geowebcache feature build in with GeoServer 2.1.3. My requirement is to use Geowebcache to speed up the process of WMS requests.

If I use http://localhost:8080/geoserver/gwc/service/wms as the geoserver address it works fine only for my default parameters values (no different even set it or not viewparams). It does not change the return images with veiwparams changed.

If I use direct integration it always serve by geoserver. How could I use geowebcache with veiwparams. my sample request as below

http://localhost:8080/geoserver/gwc/service/wms?LAYERS=MeshPlugin:ts_gd_world_mesh&FORMAT=image/png&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&VIEWPARAMS=timestep:1;datasetid:6&SRS=EPSG:4326&BBOX=112.5,22.5,135,45&WIDTH=256&HEIGHT=256

I could not see different if I change the timestep and datasetid values.

How could solve this? If I use standalone geowebcache will it work fine?

Thanks and Regards

Amila


Solution

  • For this purpose it is required to install standalone geowebcache server. Then disable geowebcache in geoserver. I did it by removing gwc dll in geoserver. Then define GEOWEBCACHE_CACHE_DIR in environment. When restated gwc it will create relevant files and folders on cache directory defined above. Then go to geowebcache.xml file and add required wms layer using <wmsLayer> tag. within wms layer tag it is possible to define viewparams as below

    <parameterFilters>  
       <regexParameterFilter>
        <key>VIEWPARAMS</key>
        <defaultValue></defaultValue>
           <regex>regex as required </regex>
      </regexParameterFilter>
    </parameterFilters>
    

    Regards

    Amila