[Geoserver-users] GWC and CQL_FILTER

Hi all

I have a cached layer with direct integration with GeoServer WMS.

According to the documentation it seems that CQL_FILTER is a supported
parameter [1].
Thought, it seems to me that sending a GetMap request with tiled=True
to GeoServer, is still hitting the database (in the GeoServer log I
can see the geotools.jdbc logged SQL).
Therefore I believe that GeoServer is managing the request as a regular WMS one.

Am I correcting assuming that CQL is supported by GWC?

On a side note, what is the best way to discover if it is GeoServer or
GWC to send the response to a request?

thanks in advance
p

[1] http://docs.geoserver.org/latest/en/user/geowebcache/using.html#supported-parameter-filters

--
Paolo Corti
Geospatial software developer
web: http://www.paolocorti.net
twitter: @capooti
skype: capooti

The paragraph at the end is important:

If a request is made using any of the above parameters, the request will be passed to GeoServer, unless a parameter filter has been set up, in which case GeoWebCache will process the request.

You need to add a parameter filter to let GWC know that it can cache based on that parameter and what values to allow.

You can check the headers of the response to see if GWC handled it. If you see geowebcache-cache-result then GWC handled the tile, it may have a value of HIT or MISS. If you make the same request again, then the result should always be HIT if caching is working.

You might also run into issues with girdset alignment if you are using anything other than the standard WGS84 or Web Mercator gridsets. The client may not know how to read the gridset info from the capabilities doc which could lead to misaligned tile requests unless you configure the client manually. If you want to enforce the use of caching, use the GWC endpoints rather than Direct Integration. If anything goes wrong then, you’ll just get an error rather than an otherwise correct response that bypasses the cache.

···

On 15 July 2014 07:25, Paolo Corti <pcorti@anonymised.com> wrote:

Hi all

I have a cached layer with direct integration with GeoServer WMS.

According to the documentation it seems that CQL_FILTER is a supported
parameter [1].
Thought, it seems to me that sending a GetMap request with tiled=True
to GeoServer, is still hitting the database (in the GeoServer log I
can see the geotools.jdbc logged SQL).
Therefore I believe that GeoServer is managing the request as a regular WMS one.

Am I correcting assuming that CQL is supported by GWC?

On a side note, what is the best way to discover if it is GeoServer or
GWC to send the response to a request?

thanks in advance
p

[1] http://docs.geoserver.org/latest/en/user/geowebcache/using.html#supported-parameter-filters


Paolo Corti
Geospatial software developer
web: http://www.paolocorti.net
twitter: @capooti
skype: capooti


Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world’s largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds


Geoserver-users mailing list
Geoserver-users@anonymised.comsts.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Kevin Smith

Junior Software Engineer | Boundless

ksmith@anonymised.com

+1-778-785-7459

@boundlessgeo

http://boundlessgeo.com/

Hi Kevin

On Wed, Jul 16, 2014 at 12:30 AM, Kevin Smith <ksmith@anonymised.com> wrote:

The paragraph at the end is important:

> If a request is made using any of the above parameters, the request will be passed to GeoServer, unless a parameter filter has been set up, in which case GeoWebCache will process the request.

You need to add a parameter filter to let GWC know that it can cache based on that parameter and what values to allow.

thanks for the explanation, I have figured out it just some minutes
after writing the email reading the doc, as always :slight_smile:

You can check the headers of the response to see if GWC handled it. If you see geowebcache-cache-result then GWC handled the tile, it may have a value of HIT or MISS. If you make the same request again, then the result should always be HIT if caching is working.

What I am trying to accomplish is to have a different cached tileset
for each different value of a field.
Just to make it more easy to understand: I have a layer named
hotspots, with a iso3 field containing the country code.
Now I would like to generate a different cache for each different
country code, readed from the CQL_FILTER parameter in the request.

I created a CQL_FILTER for the layer, using the 'list of strings'
choice (though I guess it would be possible to use the 'Regular
expression', but for now I am just testing).
As a default I have added ISO3='USA', and as allowed strings I have added:

ISO3='ITA'
ISO3='GER'
ISO3='FRA'
...

Now when sending a request like this:

LAYERS=hotspots&STYLES=&FORMAT=image/png&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&SRS=EPSG:4326&CQL_FILTER=ISO3='USA'&BBOX=-150.66830366504,-54.559164505859,214.14413666504,87.575552505859&WIDTH=847&HEIGHT=330&tiled=true

the tile is not generated by GWC, but from GeoServer WMS, as suggested
by the response header:

geowebcache-cache-result MISS
geowebcache-miss-reason no parameter filter exists for FILTER

I am pretty sure I am wrongly defining the filter, but I could not
find any sample so if you have an hint it would be greatly
appreciated.

regards
p

--
Paolo Corti
Geospatial software developer
web: http://www.paolocorti.net
twitter: @capooti
skype: capooti

It looks like something earlier in the process is rewriting the request parameters to add a FILTER parameter. I think this came up before and it was resolved by adding a FILTER parameter filter with the same values as the CQL_FILTER one.