Tile Caching in DDF
Overview
Currently the map layer data utilized by the Standard Search UI 2D and 3D maps rely on external tile services. In cases where the DDF deployment is on a private network and potentially has no or sporadic connectivity to a tile server, the DDF Search UI functionality will be limited to textual search and result visualization. Even in cases where a tile server is available, map performance map may be poor due to network latency or bandwidth limitations. An ideal solution to this problem would include
- local tile caching
- automatic cache seeding based on user interaction with the map
- administrative seeding
- tile service aggregation (1 DDF endpoint aggregates multiple external WMS services)
- runs in the DDF container without extensive modification
- includes administration services DDF can utilize
- open source licensing
GeoWebCache
http://geowebcache.org/ - licensed under LGPL.
GWC provides seeding/caching of tiles from WMS providers and a proxy capability to get around cross domain policy issues when accessing external WMS services. GWC also provides aggregation of tile services, and multiple endpoints for accessing tile data, including WMS 1.1.1, WMTS 1.0.0, and TMS 1.0.0.
Criteria | GeoWebCache | Comments |
---|---|---|
tile caching | Yes - automatic and administrative seeding | |
service aggregation | yes - WMS, WMTS, TMS | new services can be added |
runs in DDF | Yes, war will deploy in DDF with some modifications |
|
administration | easy administration via packaged REST services | could be utilized via an admin plugin |
licensing | LGPL v3 |
Endpoints
- geowebcache/rest
- rest API which includes seeding tiles from remote WMS providers and reloading configurations
- geowebcache/demo
- web pages for showing configured WMS providers and viewing map tiles - disabled for DDF
- geowebcache/home
- web page providing a service listing (WMTS/WMS/TMS) and runtime statistics - disabled for DDF
- geowebcache/service
- endpoint for WMS/WMTS/TMS services
Configuration
- WMS services are configured via an XML file - geowebcache.xml, but DDF will utilize the GWC REST services with an admin UI plugin
- the configuration can be reloaded at runtime using the geowebcache//rest/reload endpoint
- Disk quotas can be configured via an xml configuration file. See (http://geowebcache.org/docs/current/configuration/diskquotas.html)
Security
GWC utilizes spring security for its endpoints. Luckily, security can be disabled by modifying the spring security config (WEB-INF/acegi-config.xml). DDF security works with the GWC endpoints as with any of the other DDF endpoints.
GeoWebCache REST Service examples
Retrieve a list of configured layers
curl -v -k "https://localhost:8993/geowebcache/rest/layers"
<layers> <layer> <name>img states</name> <atom:link xmlns:atom="http://www.w3.org/2005/Atom" rel="alternate" href="https://localhost:8993/geowebcache/rest/layers/img+states.xml" type="text/xml"/> </layer> <layer> <name>raster</name> <atom:link xmlns:atom="http://www.w3.org/2005/Atom" rel="alternate" href="https://localhost:8993/geowebcache/rest/layers/raster.xml" type="text/xml"/> </layer> </layers>
Retrieve a specific layer
curl -v -k "https://localhost:8993/geowebcache/rest/layers/img+states.xml"
<wmsLayer> <name>img states</name> <mimeFormats> <string>image/gif</string> <string>image/jpeg</string> <string>image/png</string> <string>image/png8</string> </mimeFormats> <wmsUrl> <string>http://demo.opengeo.org/geoserver/wms?</string> </wmsUrl> <wmsLayers>nurc:Img_Sample,topp:states</wmsLayers> </wmsLayer>
Delete a layer
curl -v -k -XDELETE "https://localhost:8993/geowebcache/rest/layers/raster.xml"
The last part of the path is in the format of <layer name>.xml.
Add a layer
curl -v -k -XPUT -H "Content-type: text/xml" -d @states.xml "https://localhost:8993/geowebcache/rest/layers/states.xml"
<wmsLayer> <name>states</name> <mimeFormats> <string>image/gif</string> <string>image/jpeg</string> <string>image/png</string> <string>image/png8</string> </mimeFormats> <wmsUrl> <string>http://demo.opengeo.org/geoserver/wms</string> </wmsUrl> <wmsLayers>nurc:Img_Sample,topp:states</wmsLayers> </wmsLayer>
Modify a layer
curl -v -k -XPOST -H "Content-type: text/xml" -d @states2.xml "https://localhost:8993/geowebcache/rest/layers/states.xml"
<wmsLayer> <name>states</name> <mimeFormats> <string>image/gif</string> <string>image/jpeg</string> <string>image/png</string> </mimeFormats> <wmsUrl> <string>http://demo.opengeo.org/geoserver/wms</string> </wmsUrl> <wmsLayers>nurc:Img_Sample,topp:states</wmsLayers> </wmsLayer>
GeoWebCache Layer Schema
The layer schema for GWC can be found here: http://geowebcache.org/schema/1.5.0/geowebcache.xsd. Key wmsLayer elements:
Element | Example Value | Description |
---|---|---|
name | layer1 | The name of the layer that GWC should respond to. It is equivalent to the value of LAYERS= in WMS requests, and can contain commas. See wmsLayers |
mimeFormats | <string>image/jpeg</string> | List of formats to be supported. These must be known to GeoWebCache. Legal values are image/png, image/png8, image/png24, image/gif, image/jpeg, image/tiff, gml, application/vnd.google-earth.kml+xml, application/vnd.google-earth.kmz+xml |
wmsUrl | http://example.org/wms | A list of URLs to backend servers than can render tiles for this layer. They are used in a round robin fashion for load balancing and automatic failover. The only time you can ommit this element is if you expect the layer to be merged with that from another source. |
wmsLayers | layer1,layer2 | The LAYERS parameter sent to the WMS backend. It may contain commas, to request composites of several layers from the backend, and be different from the name element. |
wmsVersion | 1.1.1 | The VERSION parameter sent to the WMS backend. The default is 1.1.1 |
tiled | false | The TILED parameter sent to the WMS backend. The default is FALSE, you should generally not change this. |
Prototype in DDF
Remaining work
- documentation
- fix logging to use PAX Web logging (currently logging goes to std out)
- create admin UI plugin for
- service configuration
- ability to add/modify/delete tile services
- seeding
- diskquota control (see http://geowebcache.org/docs/current/configuration/diskquotas.html)
- service configuration
- verify HTTPS to external tile services - how do certs need to be configured?
- consider removal the use of the HTTP proxy in DDF for tile services (GWC is its own proxy)