Added by Mike Pumphrey, last edited by Mike Pumphrey on May 07, 2008  (view change)

Labels

 
(None)

Accelerate your maps with GeoWebCache!

Introduction

GeoWebCache is a WMS tiling client. It runs as a proxy server between a map client and map server, caching tiles as they are requested, thus saving vast amounts of processing time. Written in Java, GeoWebCache is available as a standalone product which can be integrated with many client/server combinations.  However, GeoWebCache also now exists as an extension for GeoServer. This document will be referencing this extension. (The standalone version can be integrated with GeoServer as well, with additional configuration.  For more information on the standalone product, including more examples, please see geowebcache.org.)

Installation

  1. Download the extension, which is available on the main GeoServer download page.
  2. Unpack all .jar files into %GEOSERVER_WEBAPP_PATH%/WEB-INF/lib, where %GEOSERVER_WEBAPP_PATH% is the path of your GeoServer instance.
    Step 3 is only necessary if your version of GeoServer is prior to 1.6.4.
  3. Edit %GEOSERVER_WEBAPP_PATH%/WEB-INF/web.xml . Search in the file for the <servlet-mapping> section. At the bottom of that section (right above/before the <mime-mapping> section), add the following code:
    <servlet-mapping>
        <servlet-name>dispatcher</servlet-name>
        <url-pattern>/gwc/*</url-pattern>
    </servlet-mapping>
  4. By default, GeoWebCache expects GeoServer to be accessible at the following URL:
    http://localhost:8080/geoserver
    

    To point GeoWebCache elsewhere, add the following code to the web.xml file:

    <context-param>
        <param-name>GEOSERVER_WMS_URL</param-name>
        <param-value>http://EXAMPLE.COM:PORT/PATH/wms?request=GetCapabilities</param-value>
    </context-param>

    Make sure to replace the URL inside <param-value> with your GeoServer instance's WMS GetCapabilities path.

  5. By default GeoWebCache will store cached tiles in this path: %GEOSERVER_DATA_DIR%/gwc. To change this, add the following code to web.xml:
    <context-param>
        <param-name>GEOWEBCACHE_CACHE_DIR</param-name>
        <param-value>%CACHE_PATH%</param-value>
    </context-param>

     Make sure to change %CACHE_PATH% to the path you wish to store your tiles (Examples:  /tmp, C:\temp)

  6. (Re)start your instance of GeoServer.

Using GeoWebCache

Using GeoWebCache with GeoServer is as easy as changing the URL.  For example, if your application requests WMS tiles at the following URL:

http://example.com:8080/geoserver/wms

To invoke GeoWebCache, use:

http://example.com:8080/geoserver/gwc/service/wms

As soon as tiles are requested through GeoWebCache, it automatically starts caching them.  These tiles are stored by default in the %GEOSERVER_DATA_DIR%/gwc path, with each FeatureType in its own subdirectory.  As more tiles are requested for each FeatureType, the size of this directory will grow.

Refreshing Data

Currently there is no provision for expiring cached tiles (for when the tiles on the server change).  In order to force fresh tiles to be downloaded, simply delete the directory of the cache of the FeatureType(s) in question.  GeoWebCache will then recreate the local cache as new tiles are requested.  This also means that you should not invoke GeoWebCache until the content of your layers has stabilized.

Projections

GeoWebCache currently only supports two projections:

  • EPSG:4326 (standard Latitude/Longitude)
  • EPSG:900913 (the projection used in Google Maps) 

More Information

Please see the GeoWebCache site at geowebcache.org.  The Documentationpage contains examples for integration with:

Powered by a free Atlassian Confluence Open Source Project License granted to GeoServer . Evaluate Confluence today.

GeoServer wiki is hosted by OpenGeo - Contact Administrators