[GIS] How to cache online tiles on a development machine

cacheopenlayers-2tilecache

I am developing a slippy map web application using openlayers. Right now my tiles come straight away from OSM and google, etc. For the moment I always work on the same area for development purposes and I would like to have those tiles cached on my dev machine so I can work on the web app offline yet still see some map and to reduce network consumption.

What I would like is to set up some sort of proxy which would just cache tiles I watch and if they are not on the local machine download them or show a dummy tile if I am offline.

I thought tilecache was the tool for this, but I get quite confused trying to set it up. It seems more appropriate for mapserver generating tiles from map data. I know firefox does some caching, but I would like some more control and be able to clear that cache to make sure I see the last update of my work.

What is the most straightforward way to achieve this?

Best Answer

With your purpose, i think mapproxy (www.mapproxy.org) is the best choice. MapProxy not only caches tiles, wms source but also serve the cached tiles as TMS, WMS.