TileCache, a WMS-C Implementation
Friday, November 10th, 2006The WMS Tiling Client Recommendation, was the result of a set of discussions at the FOSS4G conference in 2006. The recommendation describes a way to constrain WMS requests to a predefined grid, so that clients can request data that has been pre-rendered or rendered on the fly and the cached. Delivering cached map imagery can reduce image load times from the client’s point of view by as much as one or even two orders of magnitude.
Although some users of WMS have attempted to use naive HTTP proxies to solve the problems of WMS caching, caching HTTP proxies alone don’t take full advantage of prior knowledge of the WMS protocol, and don’t account for the various
idiosyncrasies that WMS clients can present.
Rendering map imagery on the fly for every WMS request typically requires profound hardware resources to scale well, creating a barrier to entry for organizations wishing to offer WMS access to their data. We hope that creating simple-to-deploy solutions for caching map imagery will help to push forward the publication of geographic data via WMS servers, which will in turn make more and richer maps available to more people. At MetaCarta Labs, we intend to further this goal by developing software that implements WMS caching servers and clients, such as OpenLayers and TileCache.
To that end, today, we are releasing TileCache, a WMS-C server implementation. TileCache is a Python-based WMS/TMS server, which supports pluggable caching mechanisms and rendering backends. At its simplest, it requires only write access to a disk, the ability to run Python CGI scripts, and a WMS you want to be cached. With that, you can create your own local disk-based cache of any WMS server, and use the result in any WMS-C supporting client, like OpenLayers, or any TMS supporting client, like OpenLayers and worldKit.
When running under mod_python, TileCache can handle hundreds of cache requests per second. TileCache can run on a different machine than your WMS server, and caches can be distributed across networks of machines via the memcached cache plugin. If you have some other caching mechanism you wish to use, you can write a plugin: all you need is a system where you can ‘get’, ’set’, and ‘delete’, and you can write your own Cache plugin.
This is a first step towards making WMS a sustainable solution for distributing data which may experience high user interest. Up until now,distributing data via WMS has been too resource intensive to consider as a delivery mechanism directly to users. With TileCache, this can change.
Schuyler and I have had a ton of fun writing this code, and we’ve done our best to make sure that it’s as easy as possible to install, use, and extend. If there’s problems with it, we want to know. If there’s more uses for it that we don’t know about it, we want to know. If you use it and like it, we want to know.
To see a TileCache server in action, you can visit the demo. You can also download the code or view the source.
Hopefully you find this as useful as we have. If you need any help with it, please feel free to email us at labs@metacarta.com to ask.
– Christopher Schmidt, MetaCarta Labs Developer