Caching WMS Requests Using PHP and the PEAR Cache_Lite Package

Here’s the (censored) source code I use to cache WMS requests. It’s pretty straight forward as long as you have the PEAR Cache_Lite package. Feel free to use the source code however you want. I’d appreciate a link back to my site, but I don’t require it.

WMS Cache Source Code

A few things to note:

  • lifeTime is measured in seconds.
  • min/max X/Y are specific to the images I serve. The ones there are for Ann Arbor, MI.
  • transparent.png is just a 2×2 png image which is transparent. This shows up for requests outside the box that my WMS serves.
  • You will probably have to change the url with localhost in it to be whatever WMS server your images are coming from.

3 Responses to “Caching WMS Requests Using PHP and the PEAR Cache_Lite Package”

  1. mijael Says:

    Hi Kyle. Great gob with Caching WMS Requests.

    I have been looking at kamaps caching script.

    Your work is very good and it does what it has to do.

    I would like to make you a suggestion to improve the integration of WMS and tiles. Like kamaps does in tiles.php.

    kamaps querys a big image and then cuts it into small tile’s size ones. This is necesary in many cases where the server renderes label acording to the size of the image.

    I haven’t tryed it out yet but I just wanted comment this .

    Thanks for all.

  2. Kyle Mulka Says:

    Indeed it is a good suggestion. However, I haven’t had a problem at all with requesting small tiles. Maybe that is because I don’t have any labels like you mention.

  3. gmap newbie Says:

    Hi Kyle, I have tried to study how to use Cache_Lite to cache the wms tiles to be overlayed on top of Google Maps, but I still couldn’t figure out how to make it work.

    Can you share more details about this?

    Thanks.

    Regards,
    gmap newbie

Leave a Reply