GeoWebCache / geowebcache

GeoWebCache is a tile caching server implemented in Java that provides various tile caching services like WMS-C, TMS, WMTS, Google Maps, MS Bing and more
https://www.geowebcache.org
338 stars 281 forks source link

Serving seeded/cached tiles only #58

Open justb4 opened 13 years ago

justb4 commented 13 years ago

In some cases it can be very useful to serve tiles from the cache only, i.e. only tiles that have been explicitly created through seeding. When a client requests a tile and the tile is in the cache that tile is returned immediately. If the tile is not in the cache then a blank tile is returned (i.s.o implicitly seeding the tile). In some cases a 404 return could trigger a client to show a blank tile locally.

This feature can be useful in cases where overlay tiles have sparsely distributed data. Think of GPS traces or other time-based phenomena. In the current GWC version one can configure an extent within a grid: when a tile is requested outside of that extent a blank tile is returned. This is basically the behaviour I am seeking but then for any tile that is not in the cache. This could save in cases an enormous amount of WMS backend requests, storage of blank tiles, etc. In particular once GWC will support seeding for multiple polygons.

In particular this feature is the most useful when a GeoRSS feed is used to do incremental seeding based on mutations in a backend dataset served through a WMS. If the backend geodata would have date of creation timestamps then the tilecache could be seeded by polygons in the GeoRSS feed until the current time is reached. From then on any mutations to that dataset (adds, deletes, updates) can be synchronized through that GeoRSS feed.

I hope the above clarifies the feature I am seeking. The implementation can be simple. I have been testing successfully on 1.3-SNAPSHOT. Basically if have used the with rules like where -5 denotes a value to not expire the cache but return a blank tile when the tile is not in the cache. (The value -6 denotes the same condition but sends a 404). GeoWebCacheDispatcher.handleServiceRequest() basically checks on that layer config value and if the tile is not in the cache a blank tile (or 404) is returned. I have the implementation in a github clone. Possibly using expirationRule is not optimal.

justb4 commented 13 years ago

Some text fell away in the last paragraph of the description. This feature is now enabled by a config setting in a wmsLayer in geowebcache.xml using the element expireCacheList/expirationRule for example as follows:

 <expireCacheList>
    <expirationRule minZoom="0" expiration="-5"/>
 </expireCacheList>

-5 (see GWCVars.java) denotes: "Send blank tile when tile not cached" and -6 denotes "Send 404 when tile not cached". This is possibly not the most elegant way of configuring. Possibly a new config element like "onTileNotInCache" would be more suitable maybe also taking zoomlevels into account. At least in my tests the mechanism via expirationRule works.

groldan commented 12 years ago

Hello there, sorry for the late reply. I think the correct way of implementing this requirement would be by using RequestFilters http://geowebcache.org/docs/current/configuration/layers/requestfilters.html as that's what they're meant for. So you could create a new RequestFilter that, for example, takes a geometry in WKT defining either the region to serve or to ignore. Or rather the current WMSRasterFilter can be used to obtain a raster bitmask of regions with data/no-data. If you think that'd be good enough and want to give it a try, and it satisfies your requirement, it'd be great if you could contribute some configuration examples for the documentation page above.

TIA, Gabriel

achamberlain commented 3 years ago

Hello,

I appreciate this is a (very) old thread, but as it's still open...

I would be very interested to know if this has had any further thought since being proposed?

@groldan - Your suggestion of using a geographic region to filter requests to ignore would be a good option when the geometry is simple and known, but a little more difficult when the seeded tiles (originally from an imagemosaic datastore) are scattered throughout the overall extents and number in the 10,000's.

I was therefore wondering if a simpler option would be to indicate in the configuration that no further back-end requests should be made to populate the cache?

Many thanks,

Andy