[OSM-dev] tiles at home disk usage

Jeroen Dekkers jeroen at vrijschrift.org
Wed May 2 15:46:14 BST 2007


At Wed, 2 May 2007 11:54:53 +0200,
Frederik Ramm wrote:
> Storing blue-empty or white-empty information does of course happen  
> in the database - we will need an extra column that can handle one of  
> three values: "normal tile", "empty sea tile", "empty land tile".  
> Retrieval of this information is possible in two ways:

I think we should just put this in a separate table in the
database. If we can keep this table small enough to fit in memory then
it should be fast enough, probably faster than storing things in the
filesystem.

I think we don't need to store information of zoom17 sea tiles in the
middle of the oceans, so we should probably only store information up
to level 12 and only store higher zoom sea tiles near land. There are
different scenarios how to store the information. One way would be
storing whether the tile is sea. The lookup would work like this:
query the db, if it's a sea tile, return that tile. Else lookup the
tile on the hard disk and return that. If there isn't a tile, return
the empty tile.

This does need a disk lookup for every empty tile however. A way that
might speed things up is to also store in the db whether there is an
empty at a location (or maybe whether we have tile for that location
on the hard disk). Then we don't have to do a disk search for empty
tiles.

I'm not sure what exactly to store in the db. It should be that
information that has the smallest total size, so we can try to keep
the table in memory. I also don't know what the best way to store the
info is. We can probably group 16 tiles together in one int. That
would be the equivalent of a level 15 tile. We can use bit operations
to get the information for the level 16 and 17 tiles. The first bit of
the int would be the 0,0 level 17 tile within the level 15 tile,
second bit 0,1 etc. Then we can also find out with simple bit
operations whether the level 16 and level 15 tiles are sea tiles (if
all bits say sea, then the level 15 tile is also a sea tile). We can
also pack level 12, 13 and 14 tiles that way.

> (Instead of communitcating via byte sizes, an XML "meta data file"  
> could be envisaged, but that can also be done as a tidy-up step later.)

We could also just put two simple text files called emptytiles.txt and
bluetiles.txt in the zip file. On each line there would be an x,y tile
number that is an empty or blue tile. I don't really see a need for
XML... :-)

Jeroen Dekkers




More information about the dev mailing list