.. _configuration.layers.examples: Examples ======== The following are example configurations of layers in GeoWebCache. Minimal configuration --------------------- This example shows the absolute minimum information needed to configure a layer in GeoWebCache together with the assumptions made. At the very least, GeoWebCache needs to know only two things to cache a layer: #. The URL of the WMS server #. The name of the layer as defined in the WMS .. code-block:: xml topp:states http://demo.opengeo.org/geoserver/wms In this case, the assumptions are: #. WMS version 1.1.1 is used (``version=1.1.1``) #. The layer will be valid for EPSG:4326 and EPSG:900913, with world extent (``srs=EPSG:4326``, ``srs=EPSG:900913``) #. The layer name on the WMS is identical to the name of the layer as specified here (``layers=topp:states``) #. The supported image format is PNG (image/png) and JPEG (image/jpeg) (``format=image/png``, ``format=image/jpeg``) #. The default style used (``styles=``) #. Exceptions are reported inside images (``exceptions=application/vnd.ogc.se_inimage``) #. Requests using OpenLayers are made with ``transparent=true`` Explicit blob store configuration --------------------------------- Unless otherwise specified, the tiles produced by a ``wmsLayer`` will be persisted to the cache defined by the default blob store. The ``blobStoreId`` element allows to define an alternate blob store where to store the layer tiles. See the :ref:`configuration.storage` page for more information on how to configure blob stores. In this example, the layer is configured to use the ``myBlobStore`` blob store, which must be defined in the ``blobStores`` section of ``gwcConfiguration`` with the same identifier. .. code-block:: xml myBlobStore topp:states http://demo.opengeo.org/geoserver/wms Simple configuration -------------------- The following is a more realistic but still simple example for configuring a layer in GeoWebCache. In this case, the requirements are: #. Combine two layers from a WMS, (``nurc:Img_Sample`` and ``topp:states``) #. Name the layer ``img states`` (note the space in the name) #. Set the projection to EPSG:4326 #. Limit the extent to the continental United States #. Support only GIF #. Draw the background color (where there is no data) in a shade of blue #. Set the transparency to false The resulting configuration would look like: .. code-block:: xml img states Nicer title for Image States This is a description. Fascinating. image/gif EPSG:4326 -129.6 3.45 -62.1 70.9 http://demo.opengeo.org/geoserver/wms nurc:Img_Sample,topp:states false 0x0066FF .. note:: The reference to the gridset EPSG:4326 may look a bit mysterious. It is one of only two gridsets (the other being EPSG:900913) that is automatically defined inside GeoWebCache. Other gridsets will need to be configured manually. (Learn more about :ref:`concepts.gridsets` and :ref:`configuration.layers.projections`.)