[OSM-dev] tiles at home disk usage

Robert Hart bathterror at gmail.com
Wed May 2 18:19:15 BST 2007


> The problem is: to get a pixel out of the PNG you have to unpack the
> image, then check the pixel. To get the data out of the dat file, you
> simply seek to the right point and read.
>
> So yes, you could use the image, except now every lookup has to unpack
> and load the entire image into memory. We're trading disk space for
> speed here.

I'm not saying you have to use a PNG, but you could still compact the
data without adding too much overhead.

something like:
First part of file is an index to find the data for each line of
latitude (i.e. a table of pointers/offsets in the file)
The second part is a series of pairs (value, repeat count), which
describe what you'd find as you work along that line of latitude from
end to end. A zero repeat count could indicating end of a row, but you
shouldn't need that.

I'd hazard a guess that there are typically less than a dozen
transitions between sea and land across any given line of latitude, so
worse case is to read a single value from the start of the file and a
single block from the right place.

Making the file smaller means it will always be in disk cache so will
probably run faster than a huge bitmap on disc even though there is
more code to run.

Rob


-- 
-- 
Robert Hart




More information about the dev mailing list