Talk:WMS Tile Caching

From OSGeo
Jump to: navigation, search

I want to inform you, that I am currently hacking on some kind of proxy server doing almost exactly the described thing.

What I am doing:

  • Mercator projection instead of EPSG:4236. This is because the application behind (Openstreetmap applet) is using Mercator as current projection. Implication of this is, that I cannot draw the poles at all.
  • My world is squared. I will accept bounding boxed from longitude -180 to 180 and latitude roughly -85 to 85. In the end, the projection will be exact squared. ;)
  • Currently I use 256x256 tiles, but I'll probably change this to 512x512.
  • At zoom=0, the world is one tile. Zoom=1 means 4 quarters etc.. Limit is currently zoom=16
  • I use an 32-bit integer as identifier for a tile every tile (in every zoom) has one identifier. The identifier is unique among a specific zoom level (so id+zoom is unique). The construction of this id is as follow:
    • 0 is the world
    • the next zoom level is by having the next two bits (lower bits first) set to bottom/left, which means 1 for bottom half and next 1 for left half.
      • As example, the id for the upper right quarter of the world is 0b00 = 0. The id for the upper left quarter is 0b10 = 2...
    • Then, the next zoom level is calculated by using the next two higher order bits.
    • Note, that this id scheme makes it very easy to get every tile, a specific tile is part of
      • To get the id of a lower zoom level, where your id of a higher is in, just and with 2^(zoom*2)-1
      • Example: id_4 = 0b10001011. id_3 = 0b00111111 & id_4 = 0b001011
      • This is very fast for invalidation all tiles up to zoom=0
      • The algorithm to calculate the id of a tile from a specific lat/lon is very fast this way (especally no table lookup is involved).
  • I will provide an other, non-WMS-standard access method to the server like ...&id=xxx&zoom=yy which is not suffering from any rounding lat/lon problems and such things anymore ;-)

--Imi 16:54, 31 March 2006 (CEST)