<br>It's a bit more than that, and it's not about saving space - I'm quite happy to pack the address into a 32-bit int or a 64-bit int or whatever. What I'm saying is that not interleaving the quadtile addresses is a really really bad idea. If you interleave, you need no invalidation table at all. We must have a quadtile address that (in a bit packed world), uses 2 bits to store 1st level of detail location, next 2 bits for next level of detail, and so on and so forth.
<br><br>Say we choose 16 bits of granularity to store a tile address, and let's say each tile covers an area of 1 square metre (you actually need more bits than this I think, about 28 for a reasonable LOD) For each tile, I'm going to use A B C or D (TL, TR, BL, BR). You could also use 00 01 10 11, and pack the values together. The principle is the same.
<br><br>So; someone does some editing, and invalidates tile ABCDAABC. This is fine. But, say, my slippy map tiles don't store 1m squared tiles, because that would mean it's wasting a *lot* of space, and invalidating too much. It might know, for examplke, that tile ABCC is entirely ocean. 
<br><br>So, my map tiles are, say, 16 by 16. How do I know which tiles I need to invalidate? With a quadtree, it's trivial! I invalidate tile ABCD (or any tile starting in ABCD if I have variable sized tiles).I don't need an invalidation table, I don't need to do any fancy masking, I can just examine my cache hashmap (or hashtree, more likely), and remove any entries. 
<br><br>Also, conveniently, it gives you an automatic metric to work out to what level of detail you need to cache, because you can see how many entries there are in each bucket - if it breaches a certain size, next time you invalidate it, you create 4 entries rather than 1. You don't need to work out what the 'right level of tile size' is, because it can be dynamic depending upon application and the actual data.
<br><br><div><span class="gmail_quote">On 16/09/06, <b class="gmail_sendername">Nick Hill</b> <<a href="mailto:nick@nickhill.co.uk">nick@nickhill.co.uk</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hello Nigel.<br>I think I understand that you are saying the character based system<br>enables a description of a larger tile by using fewer characters.<br><br>The same effect can be achieved in the binary system using a bitmask.
<br>We'd need to find 4 bits for every 32 bits to describe the size of tile.<br>4 bits describes 0-15, and there are 16 duples in a 32 bit word. In<br>computational terms, binary comparisons using bitwise-and are easier<br>
than substring matches.<br><br>For a 64 bit word, the mask would need to be 5 bits,<br><br>If we could tolerate a grid as coarse as 8cm over a 64 bit lat/lon<br>location, there would be enough space for a bitmask.<br><br>
<br>++However, I am not clear that there are practical benefits to have<br>variable size tiles for invalidation quadtree-style.<br><br>There is a trade-off between size of tile and size of invalidation<br>table. Smaller invalidation tiles present more records to process and a
<br>larger invalidation table. Larger tiles present a smaller invalidation<br>table, but a change can invalidate a larger area, requiring unnecessary<br>re-rendering. Tables of variable size invalidation tiles could become
<br>arbitrarily large.<br><br>A planet of 6553uD (MicroDegree) tiles sits very neatly in a 32 bit<br>word. It also is 655m N-S and 0-655m E-W, so in terms of rendered area,<br>is usually less than 12 streets. There isn't a strong incentive to
<br>complicate by having variable size invalidation tiles.<br><br>Also, if we store items in tiles of that 32 bit size, the number of<br>tiles seems just about right. An update to Catford would invalidate a<br>tile covering 1/36th of this area:
<br><br><a href="http://wiki.openstreetmap.org/images/6/65/Se6-cropped.png">http://wiki.openstreetmap.org/images/6/65/Se6-cropped.png</a><br><br>So I propose that if we should use a quad-tree principle, it would be on<br>
the basis of coding complexity comparison, computing requirement, data<br>locality in database (areas on the hard drive roughly corresponding to<br>localities in real world) and whether the easier selection of larger<br>areas is justifiable.
<br><br><br>Nigel Magnay wrote:<br>> [inline]<br>><br>> On 16/09/06, *Nick Hill* <<a href="mailto:nick@nickhill.co.uk">nick@nickhill.co.uk</a><br>> <mailto:<a href="mailto:nick@nickhill.co.uk">nick@nickhill.co.uk
</a>>> wrote:<br><br>><br>> This is required though, otherwise fetching supertiles (e.g. 'D' from my<br>> example) can't be done with a range lookup.<br>><br>> e.g: As quadtiles<br>> AA AB BA BB<br>
> AC AD BC BD<br>> CA CB DA DB<br>> CC CD DC DD<br>><br>> == as bits<br>><br>> 0000 0001 0100 0101<br>> 0010 0011 0110 0111<br>> 1000 1001 1100 1101<br>> 1010 1011 1110 1111<br>><br>> == as numbers
<br>><br>> 0 1 4 5<br>> 2 3 6 5<br>> 8 9 12 13<br>> 10 11 14 15<br>><br>> Fetch the bottom-right quadrant of the map is either ' like D%' or<br>> 'where val >= 12 and <= 15).<br>><br>> This is very important if you ever want tiles that are > than the
<br>> minimum size. If you're doing,say, tiles that are composed of some size<br>> greater than the maximum resolution. For example, you have a tile address<br>><br>> AAAB<br>><br>> and a 'tile invalidated' message arrives, for tile AAABABFB, you know,
<br>> trivially, that your tile is now invalid. The same can be done with<br>> pairs of numbers, (e.g tile 9 invalidated, my tile is >=0,<=15) but it's<br>> a bit uglier.<br>><br>><br>><br>><br>
><br>><br><br>_______________________________________________<br>dev mailing list<br><a href="mailto:dev@openstreetmap.org">dev@openstreetmap.org</a><br><a href="http://lists.openstreetmap.org/cgi-bin/mailman/listinfo/dev">
http://lists.openstreetmap.org/cgi-bin/mailman/listinfo/dev</a><br></blockquote></div><br>