Here is a short script to expire tiles based on osmchange diffs. Michal’s comment got me thinking about if there were an easy way to do it and today’s answer is yes, as long as you don’t mind it not being 100% accurate.
The script basically takes all the node locations in the diff, or referenced by ways in the diff, and expires the (meta)tile which contains that point. There are several problems with this approach:
- If a named node (e.g: a pub) is on the corner of a meta tile and its name is modified then the tile(s) containing the name should be expired as well.
- The non-local effects of mapnik’s text placement mean that changes to a way may affect its neigbours, meaning they should also be expired.
- If a way crosses the corner of a meta tile, but has no nodes within it, and is changed then that meta tile should be expired.
However, it seems to work well enough for me at the moment, although I reckon it is probably prudent to expire all the tiles every week or so, just to make sure.
Or the script can be easily extended to expire all the neighbours of expired meta tiles.
September 12th, 2008