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.

CriteriaGeoWebCacheComments
tile cachingYes - automatic and administrative seeding 
service aggregationyes - WMS, WMTS, TMSnew services can be added
runs in DDFYes, war will deploy in DDF with some modifications
  • war must be "bundled" for deployment in karaf
  • spring beans and spring security configurations must be modified
administrationeasy administration via packaged REST services

could be utilized via an admin plugin

licensingLGPL 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

Request
curl -v -k "https://localhost:8993/geowebcache/rest/layers" 
Example Get Layers Response
<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

Request
curl -v -k "https://localhost:8993/geowebcache/rest/layers/img+states.xml"
Example layer
<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

Layer Delete Request
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

Request
curl -v -k -XPUT -H "Content-type: text/xml" -d @states.xml "https://localhost:8993/geowebcache/rest/layers/states.xml"
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

Reqeust
curl -v -k -XPOST -H "Content-type: text/xml" -d @states2.xml "https://localhost:8993/geowebcache/rest/layers/states.xml"
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:

ElementExample ValueDescription
namelayer1The 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
wmsUrlhttp://example.org/wmsA 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.
wmsLayerslayer1,layer2The 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.
wmsVersion1.1.1The VERSION parameter sent to the WMS backend. The default is 1.1.1
tiledfalseThe 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
  • 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)