[OSM-dev] Slippy map way forward -- OpenLayers and/or Mapstraction?

Lars Aronsson lars at aronsson.se
Sat Jul 1 18:14:15 BST 2006

Christopher Schmidt wrote:
> On Sat, Jul 01, 2006 at 03:40:20PM +0200, Erik Johansson wrote:
> > Ok, it should be very fast to see if something has changed on a OSM
> > tile, this should do it. (though you need to move a node to get an
> > update)
> > 
> > select max(timestamp) from nodes where latitude > #{lat2}  and
> > latitude < #{lat1} and longitude > #{lon1} and longitude < #{lon2}
> > 
> Presumably, when an update is made, you kill the cached tile that is
> affected, the same way you would with squid -- the difference is, I can
> tell you how to do it with ka-Map. I've already written code to do it,
> and would be willing to do whatever it took to get it to work for OSM's
> needs...

Purging the cache when data is updated, is one way (1).  Another 
way (2) is to run Erik's query (where lat1, lon1, lat2, lon2 are 
the tile's bounding box) on every request and reuse the cached 
tile if nothing has been updated.  I don't know if Squid can do 
this test, but otherwise we could implement our own cache that 

If you are purging the cache when data is updated (1), you need to 
purge all zoom levels.  And if a node is moved or deleted, you 
need to purge the entire area spanned by all connecting line 
segments.  Note that this area has a bounding box completely 
different from the tile's bounding box.  For long line segments, 
this could be many tiles at the deeper zoom levels.  With the 
other method (2), this becomes far less complicated.

A hybrid method (3) would be to use Squid like today, but when the 
tile is requested after 48 hours, after the Squid cache has 
expired, and the tile generator is called, it applies Erik's query 
(2) and if possible returns the old cached tile instead of 
rendering it anew.  Apparently, the cache can then not be 
retrieved from the Squid where it has expired, but the tile 
generator would have to keep it's old copy in a cache of its own.

  Lars Aronsson (lars at aronsson.se)
  Aronsson Datateknik - http://aronsson.se

More information about the dev mailing list