Locally cache osm tiles

Hi, I’m developing a little GIS application where I would like to locally cache tiles from OSM. I was thinking of use TileCache but I cannot find a way to point to tile.openstreetmap.org. I would like to serve from my server cached tiles and only if old or missing get them from OSM.

Hello,

Any news in here ? I’d like to do exactly the same, so that my app won’t charge OSM servers…

Thank you!

You could simply add a (reverse) proxy cache such as squid or traffic server in between your application and tile.openstreetmap.org. You might want to force a longer expiry on the tiles though, as the tile.osm.org is optimised for editing and thus only has a cache expiry of a few hours set. Having a cache in between is a good start, however only reduces the load probably by something in the order of a half (heavily depending on your patterns of requesting tiles). So if your app becomes popular, this might still not be enough to reduce load on OSM servers, and you are best off setting up your own rendering tile server (a tutorial of how can be found e.g. at http://weait.com/content/build-your-own-openstreetmap-server)), host one at amazon EC2 (e.g. http://tiledrawer.com/)), or use one of the commercial OSM tile providers like CloudMade or Geofabrik.

hmm, ok. so I think I’ll put a varnish. My requests are really basic, I use openlayers to fetch and display maps (Europe for large scale, Switzerland for small one), and draw some vectors on it. I was pretty sure tilecache could help me, but seeing your answer, I guess varnish is a better solution.

Thank you for your answer.

See you!

T.

Hi, sorry for my late answer!

A very simple solution for caching image tiles is this cache proxy written in PHP:
http://wiki.openstreetmap.org/wiki/ProxySimplePHP
It works well with OpenLayers and might be a good choice for a web site or application.

A permanent solution to this issue is to set up your own tile server. But it is a little bit expensive. Another problem is that he will need professional help for setting it up. On the other hand if he wants only a temporary solution then he should try to add a proxy cache in between his application and tile.openstreetmap.org.